From 642979e39b30cd00f5e2a31f97f63bfc05d3b1ee Mon Sep 17 00:00:00 2001 From: Cameron Westland Date: Mon, 3 Apr 2017 15:37:39 -0700 Subject: [PATCH] dump lint rules directly in to make codacy happy --- .eslintrc.js | 193 +++++++++++++++++++++++++++++++++++++++++++ .eslintrc.json | 3 - script/prepublish.js | 2 +- 3 files changed, 194 insertions(+), 4 deletions(-) create mode 100644 .eslintrc.js delete mode 100644 .eslintrc.json diff --git a/.eslintrc.js b/.eslintrc.js new file mode 100644 index 0000000..386f018 --- /dev/null +++ b/.eslintrc.js @@ -0,0 +1,193 @@ +'use strict'; + +module.exports = { + root: true, + + parser: 'babel-eslint', + + plugins: ['import', 'jsx-a11y', 'react'], + + env: { + browser: true, + commonjs: true, + es6: true, + jest: true, + node: true, + }, + + parserOptions: { + ecmaVersion: 6, + sourceType: 'module', + ecmaFeatures: { + jsx: true, + generators: true, + experimentalObjectRestSpread: true, + }, + }, + + settings: { + 'import/ignore': ['node_modules'], + 'import/extensions': ['.js'], + 'import/resolver': { + node: { + extensions: ['.js', '.json'], + }, + }, + }, + + rules: { + // http://eslint.org/docs/rules/ + 'array-callback-return': 'warn', + 'default-case': ['warn', { commentPattern: '^no default$' }], + 'dot-location': ['warn', 'property'], + eqeqeq: ['warn', 'allow-null'], + 'new-parens': 'warn', + 'no-array-constructor': 'warn', + 'no-caller': 'warn', + 'no-cond-assign': ['warn', 'always'], + 'no-const-assign': 'warn', + 'no-control-regex': 'warn', + 'no-delete-var': 'warn', + 'no-dupe-args': 'warn', + 'no-dupe-class-members': 'warn', + 'no-dupe-keys': 'warn', + 'no-duplicate-case': 'warn', + 'no-empty-character-class': 'warn', + 'no-empty-pattern': 'warn', + 'no-eval': 'warn', + 'no-ex-assign': 'warn', + 'no-extend-native': 'warn', + 'no-extra-bind': 'warn', + 'no-extra-label': 'warn', + 'no-fallthrough': 'warn', + 'no-func-assign': 'warn', + 'no-implied-eval': 'warn', + 'no-invalid-regexp': 'warn', + 'no-iterator': 'warn', + 'no-label-var': 'warn', + 'no-labels': ['warn', { allowLoop: false, allowSwitch: false }], + 'no-lone-blocks': 'warn', + 'no-loop-func': 'warn', + 'no-mixed-operators': [ + 'warn', + { + groups: [ + ['&', '|', '^', '~', '<<', '>>', '>>>'], + ['==', '!=', '===', '!==', '>', '>=', '<', '<='], + ['&&', '||'], + ['in', 'instanceof'], + ], + allowSamePrecedence: false, + }, + ], + 'no-multi-str': 'warn', + 'no-native-reassign': 'warn', + 'no-negated-in-lhs': 'warn', + 'no-new-func': 'warn', + 'no-new-object': 'warn', + 'no-new-symbol': 'warn', + 'no-new-wrappers': 'warn', + 'no-obj-calls': 'warn', + 'no-octal': 'warn', + 'no-octal-escape': 'warn', + 'no-redeclare': 'warn', + 'no-regex-spaces': 'warn', + 'no-restricted-syntax': ['warn', 'LabeledStatement', 'WithStatement'], + 'no-script-url': 'warn', + 'no-self-assign': 'warn', + 'no-self-compare': 'warn', + 'no-sequences': 'warn', + 'no-shadow-restricted-names': 'warn', + 'no-sparse-arrays': 'warn', + 'no-template-curly-in-string': 'warn', + 'no-this-before-super': 'warn', + 'no-throw-literal': 'warn', + 'no-undef': 'error', + 'no-restricted-globals': ['error', 'event'], + 'no-unexpected-multiline': 'warn', + 'no-unreachable': 'warn', + 'no-unused-expressions': [ + 'warn', + { + allowShortCircuit: true, + allowTernary: true, + }, + ], + 'no-unused-labels': 'warn', + 'no-unused-vars': [ + 'warn', + { + vars: 'local', + varsIgnorePattern: '^_', + args: 'none', + ignoreRestSiblings: true, + }, + ], + 'no-use-before-define': ['warn', 'nofunc'], + 'no-useless-computed-key': 'warn', + 'no-useless-concat': 'warn', + 'no-useless-constructor': 'warn', + 'no-useless-escape': 'warn', + 'no-useless-rename': [ + 'warn', + { + ignoreDestructuring: false, + ignoreImport: false, + ignoreExport: false, + }, + ], + 'no-with': 'warn', + 'no-whitespace-before-property': 'warn', + 'operator-assignment': ['warn', 'always'], + radix: 'warn', + 'require-yield': 'warn', + 'rest-spread-spacing': ['warn', 'never'], + strict: ['warn', 'never'], + 'unicode-bom': ['warn', 'never'], + 'use-isnan': 'warn', + 'valid-typeof': 'warn', + 'no-restricted-properties': [ + 'error', + { + object: 'require', + property: 'ensure', + message: 'Please use import() instead. More info: https://webpack.js.org/guides/code-splitting-import/#dynamic-import', + }, + { + object: 'System', + property: 'import', + message: 'Please use import() instead. More info: https://webpack.js.org/guides/code-splitting-import/#dynamic-import', + }, + ], + + + 'import/no-webpack-loader-syntax': 'error', + + // https://github.com/yannickcr/eslint-plugin-react/tree/master/docs/rules + 'react/jsx-equals-spacing': ['warn', 'never'], + 'react/jsx-no-duplicate-props': ['warn', { ignoreCase: true }], + 'react/jsx-no-undef': 'error', + 'react/jsx-pascal-case': [ + 'warn', + { + allowAllCaps: true, + ignore: [], + }, + ], + 'react/jsx-uses-react': 'warn', + 'react/jsx-uses-vars': 'warn', + 'react/no-danger-with-children': 'warn', + 'react/no-deprecated': 'warn', + 'react/no-direct-mutation-state': 'warn', + 'react/no-is-mounted': 'warn', + 'react/react-in-jsx-scope': 'error', + 'react/require-render-return': 'warn', + 'react/style-prop-object': 'warn', + + // https://github.com/evcohen/eslint-plugin-jsx-a11y/tree/master/docs/rules + 'jsx-a11y/aria-role': 'warn', + 'jsx-a11y/img-has-alt': 'warn', + 'jsx-a11y/img-redundant-alt': 'warn', + 'jsx-a11y/no-access-key': 'warn' + }, +}; \ No newline at end of file diff --git a/.eslintrc.json b/.eslintrc.json deleted file mode 100644 index 4bed466..0000000 --- a/.eslintrc.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "extends": "react-app" -} \ No newline at end of file diff --git a/script/prepublish.js b/script/prepublish.js index 374e130..8ab55fa 100644 --- a/script/prepublish.js +++ b/script/prepublish.js @@ -29,7 +29,7 @@ console.log('Generating .d.ts files'); * Copy .d.ts files into lib */ -const r = path.join(__dirname, '..', 'build', 'dist'); +const r = path.join(__dirname, '..', 'build', 'dist') const directories = new Set(); const files = new Map();