Kaynağa Gözat

clean up lint config

Steven Silvester 5 yıl önce
ebeveyn
işleme
742f383c52
3 değiştirilmiş dosya ile 25 ekleme ve 225 silme
  1. 22 220
      .eslintrc.js
  2. 1 1
      lint-staged.config.js
  3. 2 4
      package.json

+ 22 - 220
.eslintrc.js

@@ -18,232 +18,34 @@ module.exports = {
   },
   plugins: ['@typescript-eslint'],
   rules: {
-    indent: ['error', 2],
-    'linebreak-style': ['error', 'unix'],
-    'no-console': [
-      'error',
-      {
-        allow: ['error', 'warn', 'debug']
-      }
-    ],
-    'arrow-body-style': [0],
-    curly: 'error',
-    'lines-around-comment': [0],
-    'max-len': 'off',
-    'no-confusing-arrow': [0],
-    'no-mixed-operators': [0],
-    'no-tabs': [0],
-    'no-unexpected-multiline': [0],
-    'prefer-arrow-callback': [0],
-    quotes: [0],
-    'array-bracket-newline': ['off'],
-    'array-bracket-spacing': ['off'],
-    'array-element-newline': ['off'],
-    'arrow-parens': ['off'],
-    'arrow-spacing': ['off'],
-    'block-spacing': ['off'],
-    'brace-style': ['off'],
-    'comma-dangle': 'off',
-    'comma-spacing': ['off'],
-    'comma-style': ['off'],
-    'computed-property-spacing': ['off'],
-    'dot-location': ['off'],
-    'eol-last': 'error',
-    'func-call-spacing': ['off'],
-    'function-call-argument-newline': ['off'],
-    'function-paren-newline': ['off'],
-    'generator-star': ['off'],
-    'generator-star-spacing': ['off'],
-    'implicit-arrow-linebreak': ['off'],
-    'jsx-quotes': ['off'],
-    'key-spacing': ['off'],
-    'keyword-spacing': ['off'],
-    'multiline-ternary': ['off'],
-    'newline-per-chained-call': ['off'],
-    'new-parens': 'error',
-    'no-arrow-condition': ['off'],
-    'no-comma-dangle': ['off'],
-    'no-extra-parens': ['off'],
-    'no-extra-semi': ['off'],
-    'no-floating-decimal': ['off'],
-    'no-mixed-spaces-and-tabs': ['off'],
-    'no-multi-spaces': ['off'],
-    'no-multiple-empty-lines': 'off',
-    'no-reserved-keys': ['off'],
-    'no-space-before-semi': ['off'],
-    'no-trailing-spaces': 'error',
-    'no-whitespace-before-property': ['off'],
-    'no-wrap-func': ['off'],
-    'nonblock-statement-body-position': ['off'],
-    'object-curly-newline': ['off'],
-    'object-curly-spacing': ['off'],
-    'object-property-newline': ['off'],
-    'one-var-declaration-per-line': ['off'],
-    'operator-linebreak': ['off'],
-    'padded-blocks': ['off'],
-    'quote-props': ['off'],
-    'rest-spread-spacing': ['off'],
-    semi: ['off'],
-    'semi-spacing': ['off'],
-    'semi-style': ['off'],
-    'space-after-function-name': ['off'],
-    'space-after-keywords': ['off'],
-    'space-before-blocks': ['off'],
-    'space-before-function-paren': ['off'],
-    'space-before-function-parentheses': ['off'],
-    'space-before-keywords': ['off'],
-    'space-in-brackets': ['off'],
-    'space-in-parens': ['off'],
-    'space-infix-ops': ['off'],
-    'space-return-throw-case': ['off'],
-    'space-unary-ops': ['off'],
-    'space-unary-word-ops': ['off'],
-    'switch-colon-spacing': ['off'],
-    'template-curly-spacing': ['off'],
-    'template-tag-spacing': ['off'],
-    'unicode-bom': ['off'],
-    'wrap-iife': ['off'],
-    'wrap-regex': ['off'],
-    'yield-star-spacing': ['off'],
-    'indent-legacy': ['off'],
-    'no-spaced-func': ['off'],
-    'constructor-super': ['error'],
-    'for-direction': ['error'],
-    'getter-return': ['error'],
-    'no-async-promise-executor': ['error'],
-    'no-case-declarations': ['off'],
-    'no-class-assign': ['error'],
-    'no-compare-neg-zero': ['error'],
-    'no-cond-assign': 'error',
-    'no-const-assign': ['error'],
-    'no-constant-condition': ['error'],
-    'no-control-regex': ['off'],
-    'no-debugger': 'error',
-    'no-delete-var': ['error'],
-    'no-dupe-args': ['error'],
-    'no-dupe-class-members': ['error'],
-    'no-dupe-keys': ['error'],
-    'no-duplicate-case': ['error'],
-    'no-empty': 'error',
-    'no-empty-character-class': ['error'],
-    'no-empty-pattern': ['error'],
-    'no-ex-assign': ['error'],
-    'no-extra-boolean-cast': ['error'],
-    'no-fallthrough': 'error',
-    'no-func-assign': ['error'],
-    'no-global-assign': ['error'],
-    'no-inner-declarations': ['off'],
-    'no-invalid-regexp': ['error'],
-    'no-irregular-whitespace': ['error'],
-    'no-misleading-character-class': ['error'],
-    'no-new-symbol': ['error'],
-    'no-obj-calls': ['error'],
-    'no-octal': ['error'],
-    'no-prototype-builtins': ['off'],
-    'no-redeclare': 'warn',
-    'no-regex-spaces': ['error'],
-    'no-self-assign': ['error'],
-    'no-shadow-restricted-names': ['error'],
-    'no-sparse-arrays': ['error'],
-    'no-this-before-super': ['error'],
-    'no-unreachable': ['error'],
-    'no-unsafe-finally': ['error'],
-    'no-unsafe-negation': ['error'],
-    'no-unused-labels': 'error',
-    '@typescript-eslint/no-unused-vars': ['warn', { args: 'none' }],
-    '@typescript-eslint/no-namespace': 'off',
-    'no-useless-catch': ['error'],
-    'no-useless-escape': ['off'],
-    'no-with': ['error'],
-    'require-yield': ['error'],
-    'use-isnan': 'error',
-    'valid-typeof': ['error'],
-    '@typescript-eslint/class-name-casing': 'error',
-    '@typescript-eslint/consistent-type-assertions': 'error',
-    '@typescript-eslint/explicit-member-accessibility': [
-      'off',
-      {
-        accessibility: 'explicit'
-      }
-    ],
-    '@typescript-eslint/indent': [
-      'error',
-      2,
-      {
-        FunctionDeclaration: {
-          parameters: 'first'
-        },
-        FunctionExpression: {
-          parameters: 'first'
-        }
-      }
-    ],
+    '@typescript-eslint/no-floating-promises': ['error', { ignoreVoid: true }],
     '@typescript-eslint/interface-name-prefix': [
       'error',
       { prefixWithI: 'always' }
     ],
-    '@typescript-eslint/member-delimiter-style': [
-      'error',
-      {
-        multiline: {
-          delimiter: 'semi',
-          requireLast: true
-        },
-        singleline: {
-          delimiter: 'semi',
-          requireLast: false
-        }
-      }
-    ],
-    '@typescript-eslint/ban-ts-ignore': 'off',
-    '@typescript-eslint/member-ordering': 'off',
-    '@typescript-eslint/no-empty-function': 'error',
-    '@typescript-eslint/no-explicit-any': 'off',
-    '@typescript-eslint/no-floating-promises': ['error', { ignoreVoid: true }],
-    '@typescript-eslint/no-inferrable-types': 'off',
-    '@typescript-eslint/no-require-imports': 'off',
+    '@typescript-eslint/no-unused-vars': ['warn', { args: 'none' }],
     '@typescript-eslint/no-use-before-define': 'off',
-    '@typescript-eslint/no-var-requires': 'off',
-    '@typescript-eslint/prefer-namespace-keyword': 'error',
+    '@typescript-eslint/camelcase': 'off',
+    '@typescript-eslint/no-explicit-any': 'off',
+    '@typescript-eslint/no-non-null-assertion': 'off',
+    '@typescript-eslint/no-namespace': 'off',
     '@typescript-eslint/explicit-function-return-type': 'off',
-    '@typescript-eslint/quotes': [
-      'off',
-      'single',
-      {
-        avoidEscape: true
-      }
-    ],
-    '@typescript-eslint/semi': ['error', 'always'],
-    '@typescript-eslint/triple-slash-reference': 'off',
-    '@typescript-eslint/type-annotation-spacing': 'off',
+    '@typescript-eslint/ban-ts-ignore': 'warn',
+    '@typescript-eslint/no-var-requires': 'off',
     '@typescript-eslint/no-empty-interface': 'off',
-    '@typescript-eslint/camelcase': 'off',
-    'default-case': 'error',
-    'dot-notation': 'off',
-    'no-undef': 'off',
-    'prefer-const': 'off',
-    eqeqeq: ['error', 'smart'],
-    'guard-for-in': 'off',
-    'id-blacklist': ['error', 'any', 'boolean', 'Undefined'],
-    'id-match': 'error',
-    'import/no-default-export': 'off',
-    'no-bitwise': 'off',
-    'no-caller': 'error',
-    'no-eval': 'error',
-    'no-invalid-this': 'off',
-    'no-new-wrappers': 'error',
-    'no-null/no-null': 'off',
-    'no-shadow': [
-      'off',
-      {
-        hoist: 'all'
-      }
-    ],
-    'no-underscore-dangle': 'off',
-    'no-var': 'error',
-    'one-var': ['error', 'never'],
-    radix: 'error',
-    '@typescript-eslint/no-non-null-assertion': 'off'
+    '@typescript-eslint/triple-slash-reference': 'warn',
+    '@typescript-eslint/no-inferrable-types': 'off',
+    'no-inner-declarations': 'off',
+    'no-prototype-builtins': 'off',
+    'no-control-regex': 'warn',
+    'no-undef': 'warn',
+    'no-case-declarations': 'warn',
+    'no-useless-escape': 'off',
+    'prefer-const': 'warn'
   },
-  settings: {}
+  settings: {
+    react: {
+      version: 'detect'
+    }
+  }
 };

+ 1 - 1
lint-staged.config.js

@@ -19,8 +19,8 @@ module.exports = {
   '**/*{.ts,.tsx,.js,.jsx}': filenames => {
     const escapedFileNames = escapeFileNames(filenames);
     return [
-      `prettier --write ${escapedFileNames}`,
       `eslint --fix ${escapedFileNames}`,
+      `prettier --write ${escapedFileNames}`,
       `git add ${escapedFileNames}`
     ];
   }

+ 2 - 4
package.json

@@ -60,8 +60,8 @@
     "lighthouse:compare": "node testutils/lib/compare-lighthouse.js",
     "lighthouse:throttling:start": "comcast --latency=40 --target-bw=30000 --packet-loss=0.2%",
     "lighthouse:throttling:stop": "comcast --stop",
-    "lint": "jlpm && jlpm run prettier && jlpm run eslint",
-    "lint:check": "jlpm run prettier:check && jlpm run eslint:check",
+    "lint": "jlpm && jlpm run eslint && jlpm run prettier",
+    "lint:check": "jlpm run eslint:check && jlpm run prettier:check",
     "patch:release": "node buildutils/lib/patch-release.js",
     "prepublish:check": "node buildutils/lib/prepublish-check.js",
     "prettier": "prettier --write \"**/*{.ts,.tsx,.js,.jsx,.css,.json,.md}\"",
@@ -79,8 +79,6 @@
     "test:ie": "lerna run test:ie --scope \"@jupyterlab/*\" --concurrency 1 --stream",
     "test:scope": "lerna run test --concurrency 1 --stream",
     "test:summary": "lerna run test --scope \"@jupyterlab/test-*\" --parallel --no-bail | grep -Ei '.* test.*(failed|passed|total|completed|skipped)' | sort",
-    "tslint": "tslint --fix -c tslint.json --project tsconfigbase.json '**/*{.ts,.tsx}'",
-    "tslint:check": "tslint -c tslint.json --project tsconfigbase.json '**/*{.ts,.tsx}'",
     "update:dependency": "node buildutils/lib/update-dependency.js --lerna",
     "watch": "python scripts/watch_dev.py",
     "watch:main": "jlpm run watch",