Skip to content

Commit

Permalink
feat: add ts config
Browse files Browse the repository at this point in the history
  • Loading branch information
antfu committed Jul 17, 2019
1 parent 2592271 commit b025b09
Show file tree
Hide file tree
Showing 8 changed files with 77 additions and 28 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -78,4 +78,4 @@ dist
.idea

package-lock.json
*.learna_backup
*.lerna_backup
17 changes: 16 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,24 @@
"license": "MIT",
"scripts": {
"postinstall": "lerna bootstrap",
"lint": "lerna run lint",
"lint:fix": "lerna run lint -- -- --fix",
"release": "lerna publish --conventional-commits"
},
"devDependencies": {
"lerna": "^3.14.1"
"@antfu/eslint-config": "^0.1.5",
"@typescript-eslint/eslint-plugin": "1.11.0",
"@typescript-eslint/parser": "^1.10.2",
"eslint": "^6.0.1",
"eslint-config-standard": "^12.0.0",
"eslint-plugin-import": "^2.18.0",
"eslint-plugin-node": "^9.1.0",
"eslint-plugin-nuxt": "0.4.3",
"eslint-plugin-promise": "^4.2.1",
"eslint-plugin-standard": "^4.0.0",
"eslint-plugin-unicorn": "^9.1.1",
"eslint-plugin-vue": "5.2.3",
"lerna": "^3.14.1",
"typescript": "^3.5.3"
}
}
25 changes: 3 additions & 22 deletions packages/common/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,18 @@ module.exports = {
browser: true,
node: true,
},
plugins: [
'@typescript-eslint',
],
parser: '@typescript-eslint/parser',
extends: [
'standard',
'plugin:import/errors',
'plugin:import/warnings',
'plugin:@typescript-eslint/recommended',
],
plugins: [
'unicorn',
],
settings: {
'import/resolver': {
node: { extensions: ['.js', '.mjs'] }
}
node: { extensions: ['.js', '.mjs'] },
},
},
rules: {
// import
Expand Down Expand Up @@ -59,10 +54,6 @@ module.exports = {
'no-spaced-func': 'error',
'object-curly-spacing': ['error', 'always'],
'no-return-await': 'off',
'prefer-const': ['error', {
'destructuring': 'any',
'ignoreReadBeforeAssign': false
}],

// es6
'no-var': 'error',
Expand Down Expand Up @@ -103,16 +94,6 @@ module.exports = {
'no-return-assign': 'off',
'operator-linebreak': [2, 'before'],

// TS
'@typescript-eslint/no-unused-vars': [2, { args: 'none' }],
'@typescript-eslint/indent': ['error', 2],
'@typescript-eslint/member-delimiter-style': ['error', { multiline: { delimiter: 'none' } }],
'@typescript-eslint/type-annotation-spacing': ['error', {}],
'@typescript-eslint/camelcase': 'off',
'@typescript-eslint/explicit-function-return-type': 'off',
'@typescript-eslint/explicit-member-accessibility': 'off',
'@typescript-eslint/no-explicit-any': 'off',

// unicorns
// Pass error message when throwing errors
'unicorn/error-message': 'error',
Expand All @@ -138,5 +119,5 @@ module.exports = {
'unicorn/prefer-type-error': 'error',
// Use new when throwing error
'unicorn/throw-new-error': 'error',
}
},
}
3 changes: 1 addition & 2 deletions packages/common/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,7 @@
"eslint-plugin-unicorn": "^9.1.1"
},
"devDependencies": {
"eslint": "^6.0.1",
"standard-version": "^6.0.1"
"eslint": "^6.0.1"
},
"gitHead": "bd0460759c73f7fcdf32570f40a13e37ab6961c0"
}
21 changes: 21 additions & 0 deletions packages/typescript/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
module.exports = {
plugins: [
'@typescript-eslint',
],
parser: '@typescript-eslint/parser',
extends: [
'@antfu/eslint-config',
'plugin:@typescript-eslint/recommended',
],
rules: {
// TS
'@typescript-eslint/no-unused-vars': [2, { args: 'none' }],
'@typescript-eslint/indent': ['error', 2],
'@typescript-eslint/member-delimiter-style': ['error', { multiline: { delimiter: 'none' } }],
'@typescript-eslint/type-annotation-spacing': ['error', {}],
'@typescript-eslint/camelcase': 'off',
'@typescript-eslint/explicit-function-return-type': 'off',
'@typescript-eslint/explicit-member-accessibility': 'off',
'@typescript-eslint/no-explicit-any': 'off',
}
}
32 changes: 32 additions & 0 deletions packages/typescript/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{
"name": "@antfu/eslint-config-ts",
"version": "0.1.5",
"description": "",
"main": "index.js",
"keywords": [],
"author": "Anthony Fu <anthonyfu117@hotmail.com> (https://github.com/antfu/)",
"license": "MIT",
"scripts": {
"lint": "eslint . --config=index.js"
},
"files": [
"index.js"
],
"publishConfig": {
"access": "public"
},
"peerDependencies": {
"eslint": ">=5.16.0",
"typescript": ">=3.5"
},
"dependencies": {
"@antfu/eslint-config": "^0.1.5",
"@typescript-eslint/eslint-plugin": "1.11.0",
"@typescript-eslint/parser": "^1.10.2"
},
"devDependencies": {
"eslint": "^6.0.1",
"typescript": "^3.5.3"
},
"gitHead": "bd0460759c73f7fcdf32570f40a13e37ab6961c0"
}
2 changes: 1 addition & 1 deletion packages/vue/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ module.exports = {
parser: '@typescript-eslint/parser',
},
extends: [
'@antfu/eslint-config',
'@antfu/eslint-config-ts',
'plugin:vue/recommended',
],
plugins: [
Expand Down
3 changes: 2 additions & 1 deletion packages/vue/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@
"eslint-plugin-vue": "5.2.3"
},
"devDependencies": {
"eslint": "^6.0.1"
"eslint": "^6.0.1",
"typescript": "^3.5.3"
},
"gitHead": "bd0460759c73f7fcdf32570f40a13e37ab6961c0"
}

0 comments on commit b025b09

Please sign in to comment.