Skip to content

Commit

Permalink
less lint config (#72)
Browse files Browse the repository at this point in the history
* fast eslint

* close some rules

* close some rules

* fix test

* fix ts

* fix lint

* fix demo types

* close some types

* add new config

* prettier all code

* add ts config

* add ts config

* add ts config

* add ts config

* add ts config

* add ts config

* fix ts

* close import

* close import

* close import
  • Loading branch information
chenshuai2144 committed Dec 20, 2020
1 parent 185ca53 commit cf1d1c0
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 40 deletions.
2 changes: 1 addition & 1 deletion example/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"lint-staged": "lint-staged",
"lint-staged:js": "eslint --ext .js,.jsx,.ts,.tsx ",
"lint:fix": "eslint --fix --cache --ext .js,.jsx,.ts,.tsx --format=pretty ./src && npm run lint:style",
"lint:js": "eslint --cache --ext .js,.jsx,.ts,.tsx --format=pretty ./src",
"lint:js": "cross-env TIMING=1 eslint --cache --ext .js,.jsx,.ts,.tsx --format=pretty ./src",
"lint:prettier": "prettier --check \"**/*\" --end-of-line auto",
"lint:style": "stylelint --fix \"src/**/*.less\" --syntax less",
"prettier": "prettier -c --write \"**/*\""
Expand Down
6 changes: 4 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,11 @@
"scripts": {
"build": "tsc --build tsconfig.json",
"deps": "yarn upgrade-interactive --latest",
"lib": "cross-env TIMING=1 eslint lib",
"lint": "npm run build && cd example && npm run lint",
"prepublishOnly": "npm run build && npm test && np --no-cleanup --yolo --no-publish --any-branch",
"test": "npm run build && cd example && npm run lint",
"prettier": "prettier -c --write \"**/*\""
"prettier": "prettier -c --write \"**/*\"",
"test": "npm run build && cd example && npm run lint"
},
"dependencies": {
"@typescript-eslint/eslint-plugin": "^4.10.0",
Expand Down Expand Up @@ -61,6 +62,7 @@
"typescript": "^4.0.2"
},
"devDependencies": {
"cross-env": "^7.0.3",
"np": "^6.2.5",
"prettier": "^2.2.1"
}
Expand Down
51 changes: 18 additions & 33 deletions src/eslint.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,49 +37,34 @@ module.exports = {
'react/jsx-one-expression-per-line': 0,
'generator-star-spacing': 0,
'function-paren-newline': 0,
'import/no-unresolved': [
2,
{
ignore: ['^@/', '^@@/', '^@alipay/bigfish/'],
caseSensitive: true,
commonjs: true,
},
],
'import/order': 'warn',
'react/jsx-props-no-spreading': 0,
'react/state-in-constructor': 0,
'no-confusing-arrow': 1,
'react/static-property-placement': 0,
'import/no-extraneous-dependencies': [
2,
{
optionalDependencies: true,
devDependencies: [
'**/tests/**.{ts,js,jsx,tsx}',
'**/_test_/**.{ts,js,jsx,tsx}',
'/mock/**/**.{ts,js,jsx,tsx}',
'**/**.test.{ts,js,jsx,tsx}',
'**/_mock.{ts,js,jsx,tsx}',
'**/example/**.{ts,js,jsx,tsx}',
'**/examples/**.{ts,js,jsx,tsx}',
],
},
],
'import/no-unresolved': 0,
'import/order': 0,
'import/no-named-as-default': 0,
'import/no-cycle': 0,
'import/prefer-default-export': 0,
'import/no-default-export': 0,
'import/no-extraneous-dependencies': 0,
'import/named': 0,
'import/no-named-as-default-member': 0,
'import/no-duplicates': 0,
'import/no-self-import': 0,
'import/no-useless-path-segments': 0,
'jsx-a11y/no-noninteractive-element-interactions': 0,
'jsx-a11y/click-events-have-key-events': 0,
'jsx-a11y/no-static-element-interactions': 0,
'jsx-a11y/anchor-is-valid': 0,
'sort-imports': 0,
'no-confusing-arrow': 1,
'linebreak-style': 0,
// Too restrictive, writing ugly code to defend against a very unlikely scenario: https://eslint.org/docs/rules/no-prototype-builtins
'no-prototype-builtins': 'off',
'import/prefer-default-export': 'off',
'import/no-default-export': [0, 'camel-case'],
'unicorn/prevent-abbreviations': 'off',
'react/jsx-props-no-spreading': 0,
'react/state-in-constructor': 0,
'react/static-property-placement': 0,
// Too restrictive: https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/destructuring-assignment.md
'react/destructuring-assignment': 'off',
'react/jsx-filename-extension': 'off',
'unicorn/prevent-abbreviations': 'off',
'sort-imports': 0,
'import/no-cycle': 0,
'react/no-array-index-key': 'warn',
'react-hooks/rules-of-hooks': 'error', // Checks rules of Hooks
'react-hooks/exhaustive-deps': 'warn', // Checks deps of Hooks
Expand Down
8 changes: 4 additions & 4 deletions src/tsEslintConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,9 @@ export default {
'@typescript-eslint/method-signature-style': 'error',
'no-array-constructor': 'off',
'@typescript-eslint/no-array-constructor': 0,
'@typescript-eslint/no-base-to-string': 'error',
'@typescript-eslint/no-base-to-string': 0,
'@typescript-eslint/no-confusing-non-null-assertion': 'error',
'@typescript-eslint/no-confusing-void-expression': 1,
'@typescript-eslint/no-confusing-void-expression': 0,
'no-dupe-class-members': 'off',
'@typescript-eslint/no-dupe-class-members': 'error',
'no-duplicate-imports': 'off',
Expand All @@ -55,7 +55,7 @@ export default {
'@typescript-eslint/no-for-in-array': 'error',
'@typescript-eslint/no-implicit-any-catch': 0,
'no-implied-eval': 'off',
'@typescript-eslint/no-implied-eval': 'error',
'@typescript-eslint/no-implied-eval': 0,
'@typescript-eslint/no-inferrable-types': 0,
'no-invalid-this': 'off',
'@typescript-eslint/no-invalid-this': 'error',
Expand All @@ -67,7 +67,7 @@ export default {
'no-magic-numbers': 'off',
'@typescript-eslint/no-magic-numbers': 0,
'@typescript-eslint/no-misused-new': 'error',
'@typescript-eslint/no-misused-promises': 'error',
'@typescript-eslint/no-misused-promises': 0,
'@typescript-eslint/no-namespace': 1,
'@typescript-eslint/no-non-null-asserted-optional-chain': 'error',
'@typescript-eslint/no-parameter-properties': 'error',
Expand Down

0 comments on commit cf1d1c0

Please sign in to comment.