Skip to content

Commit

Permalink
add basic support for typescript
Browse files Browse the repository at this point in the history
  • Loading branch information
fschade committed Jun 2, 2021
1 parent 7e865f8 commit c2f6949
Show file tree
Hide file tree
Showing 7 changed files with 1,433 additions and 1,656 deletions.
48 changes: 48 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
module.exports = {
env: {
browser: true,
es6: true,
amd: true
},
extends: [
/**
* TODO: fix promise project issues and then enable it
* 'plugin:promise/recommended',
*/
'standard',
'prettier/standard',
'plugin:prettier/recommended',
'plugin:jest/recommended'
],
parserOptions: {
parser: 'babel-eslint',
sourceType: 'module'
},
rules: {
/**
* TODO: fix project import issues and then enable it
* 'sort-imports': 'warn',
*/
'require-await': 'warn'
},
globals: {
require: false,
requirejs: false
},
plugins: ['jest'],
overrides: [
{
files: ['**/*.vue'],
extends: ['plugin:vue/recommended', 'prettier/vue']
},
{
files: ['**/*.ts'],
parser: '@typescript-eslint/parser',
extends: ['plugin:@typescript-eslint/recommended']
},
{
files: ['**/*.spec.js'],
extends: ['plugin:jest/recommended']
}
]
}
29 changes: 0 additions & 29 deletions .eslintrc.json

This file was deleted.

11 changes: 7 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"build": "rollup -c",
"build:w": "rollup -c -w",
"depcheck": "depcheck",
"lint": "eslint packages/*/src tests --ext vue --ext js --color",
"lint": "eslint packages/*/src tests --color",
"serve": "SERVER=true yarn build:w",
"test:acceptance:drone": "cucumber-js --retry 1 --require-module @babel/register --require-module @babel/polyfill --require tests/acceptance/setup.js --require tests/acceptance/stepDefinitions --format node_modules/cucumber-pretty ${TEST_PATHS:-tests/acceptance/features/$TEST_CONTEXT} -t \"${TEST_TAGS}\"",
"test:acceptance:oc10": "cucumber-js --require-module @babel/register --require-module @babel/polyfill --require tests/acceptance/setup.js --require tests/acceptance/stepDefinitions --format node_modules/cucumber-pretty -t \"${TEST_TAGS:-not @skip and not @skipOnOC10}\"",
Expand All @@ -39,6 +39,10 @@
"@rollup/plugin-commonjs": "^17.0.0",
"@rollup/plugin-html": "^0.2.0",
"@rollup/plugin-json": "^4.1.0",
"@rollup/plugin-typescript": "^8.2.1",
"@types/jest": "^26.0.23",
"@typescript-eslint/eslint-plugin": "^4.26.0",
"@typescript-eslint/parser": "^4.26.0",
"@vue/test-utils": "^1.1.2",
"archiver": "^3.0.0",
"autoprefixer": "^10.2.4",
Expand All @@ -54,12 +58,9 @@
"eslint": "6.8.0",
"eslint-config-prettier": "^6.10.0",
"eslint-config-standard": "^14.1.0",
"eslint-plugin-import": "^2.18.2",
"eslint-plugin-jest": "^24.1.3",
"eslint-plugin-node": "^11.0.0",
"eslint-plugin-prettier": "^3.1.2",
"eslint-plugin-promise": "^4.2.1",
"eslint-plugin-standard": "^4.0.0",
"eslint-plugin-vue": "^6.2.2",
"fs-extra": "^9.0.1",
"jest": "^26.6.3",
Expand Down Expand Up @@ -91,6 +92,8 @@
"rollup-plugin-terser": "^7.0.2",
"rollup-plugin-visualizer": "^4.2.0",
"rollup-plugin-vue": "^5.1.4",
"ts-jest": "^26.5.6",
"typescript": "^4.3.2",
"url-search-params-polyfill": "^8.0.0",
"vue-jest": "^3.0.7",
"vue-template-compiler": "^2.6.12",
Expand Down
2 changes: 2 additions & 0 deletions rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import serve from 'rollup-plugin-serve'
import livereload from 'rollup-plugin-livereload'
import html from '@rollup/plugin-html'
import globals from 'rollup-plugin-node-globals'
import typescript from '@rollup/plugin-typescript'

const production = !process.env.ROLLUP_WATCH

Expand Down Expand Up @@ -58,6 +59,7 @@ const plugins = [
'l(o.instance+p,{method:e,body:d.body,headers:h})':
'l(o.instance+p,{method:e,body:d.body,headers:h}).catch(function(e){return r(e)})'
}),
typescript(),
globals(),
json(),
copy({
Expand Down
3 changes: 2 additions & 1 deletion tests/unit/config/jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@ const rootDir = path.resolve(__dirname, '../../../')
module.exports = {
rootDir,
modulePaths: ['<rootDir>'],
moduleFileExtensions: ['js', 'json', 'vue'],
moduleFileExtensions: ['js', 'ts', 'json', 'vue'],
transform: {
'^.+\\.(ts|tsx)$': 'ts-jest',
'^.+\\.js$': ['babel-jest', { configFile: path.join(rootDir, '.babelrc') }],
'.*\\.(vue)$': 'vue-jest',
'^.+\\.svg$': 'jest-svg-transformer'
Expand Down
5 changes: 5 additions & 0 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"compilerOptions": {
"target": "es6"
}
}
Loading

0 comments on commit c2f6949

Please sign in to comment.