├── react-hooks.js ├── node.js ├── .gitignore ├── README.md ├── package.json ├── es6.js ├── react-a11y.js ├── import.js ├── react.js ├── LICENSE └── index.js /react-hooks.js: -------------------------------------------------------------------------------- 1 | 2 | module.exports = { 3 | plugins: [ 4 | 'react-hooks', 5 | ], 6 | ignorePatterns: ['*.html', '*.svelte'], 7 | parserOptions: { 8 | ecmaFeatures: { 9 | jsx: true, 10 | }, 11 | }, 12 | rules: { 13 | 'react-hooks/rules-of-hooks': 'error', 14 | 'react-hooks/exhaustive-deps': 'error', 15 | }, 16 | }; 17 | -------------------------------------------------------------------------------- /node.js: -------------------------------------------------------------------------------- 1 | 2 | module.exports = { 3 | env: { 4 | node: true, 5 | }, 6 | rules: { 7 | 'callback-return': 'off', 8 | 'global-require': 'error', 9 | 'handle-callback-err': 'off', 10 | 'no-buffer-constructor': 'error', 11 | 'no-mixed-requires': ['off', false], 12 | 'no-new-require': 'error', 13 | 'no-path-concat': 'error', 14 | 'no-process-env': 'off', 15 | 'no-process-exit': 'off', 16 | 'no-restricted-modules': 'off', 17 | 'no-sync': 'off', 18 | } 19 | }; 20 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Logs 2 | logs 3 | *.log 4 | npm-debug.log* 5 | 6 | # Runtime data 7 | pids 8 | *.pid 9 | *.seed 10 | 11 | # Directory for instrumented libs generated by jscoverage/JSCover 12 | lib-cov 13 | 14 | # Coverage directory used by tools like istanbul 15 | coverage 16 | 17 | # Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) 18 | .grunt 19 | 20 | # node-waf configuration 21 | .lock-wscript 22 | 23 | # Compiled binary addons (http://nodejs.org/api/addons.html) 24 | build/Release 25 | 26 | # Dependency directory 27 | node_modules 28 | 29 | # Optional npm cache directory 30 | .npm 31 | 32 | # Optional REPL history 33 | .node_repl_history 34 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | 2 | # eslint-config-robin 3 | 4 | These are the rules that are used in my ([Robin Berjon](http://berjon.com/)) projects. A lot of this 5 | has been lifted from the AirBnB rules, but with distinctive variations. 6 | 7 | ## Usage 8 | 9 | Obtaining it is simple: 10 | 11 | npm install --save-dev eslint-config-robin 12 | 13 | Note that you do not need to install a bunch of other modules for this to work, it is meant to be 14 | self-contained so as to be simple to install. 15 | 16 | Normally, all your `.eslintrc` needs to contain is: 17 | 18 | ```json 19 | { 20 | "extends": "robin" 21 | } 22 | ``` 23 | 24 | ### Atom 25 | 26 | This will just work with the `linter` and `linter-eslint` plugins; just be sure to configure the 27 | latter not to use the global eslint. 28 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "eslint-config-robin", 3 | "version": "6.2.0", 4 | "description": "JavaScript, looking good", 5 | "main": "index.js", 6 | "scripts": { 7 | "test": "node -c es6.js && node -c import.js && node -c node.js && node -c react-a11y.js && node -c react-hooks.js && node -c react.js && node -c index.js" 8 | }, 9 | "eslintConfig": { 10 | "extends": "./index.js" 11 | }, 12 | "repository": { 13 | "type": "git", 14 | "url": "https://github.com/darobin/eslint-config-robin" 15 | }, 16 | "keywords": [ 17 | "eslint", 18 | "eslintconfig", 19 | "config", 20 | "javascript" 21 | ], 22 | "author": "Robin Berjon ", 23 | "license": "MIT", 24 | "bugs": { 25 | "url": "https://github.com/darobin/eslint-config-robin/issues" 26 | }, 27 | "homepage": "https://github.com/robin/eslint-config-robin", 28 | "dependencies": { 29 | "confusing-browser-globals": "^1.0.9", 30 | "eslint": "^6.8.0", 31 | "eslint-plugin-import": "^2.19.1", 32 | "eslint-plugin-jsx-a11y": "^6.2.3", 33 | "eslint-plugin-react": "^7.17.0", 34 | "eslint-plugin-react-hooks": "^2.3.0" 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /es6.js: -------------------------------------------------------------------------------- 1 | 2 | module.exports = { 3 | env: { 4 | es6: true, 5 | }, 6 | parserOptions: { 7 | ecmaVersion: 6, 8 | sourceType: 'module', 9 | ecmaFeatures: { 10 | generators: false, 11 | objectLiteralDuplicateProperties: false, 12 | } 13 | }, 14 | rules: { 15 | 'arrow-body-style': ['error', 'as-needed', { 16 | requireReturnForObjectLiteral: false, 17 | }], 18 | 'arrow-spacing': ['error', { before: true, after: true }], 19 | 'constructor-super': 'error', 20 | 'generator-star-spacing': ['error', { before: false, after: true }], 21 | 'no-class-assign': 'error', 22 | 'no-const-assign': 'error', 23 | 'no-dupe-class-members': 'error', 24 | 'no-duplicate-imports': 'off', 25 | 'no-new-symbol': 'error', 26 | 'no-restricted-imports': ['off', { 27 | paths: [], 28 | patterns: [] 29 | }], 30 | 'no-this-before-super': 'error', 31 | 'no-useless-computed-key': 'error', 32 | 'no-useless-constructor': 'error', 33 | 'no-useless-rename': ['error', { 34 | ignoreDestructuring: false, 35 | ignoreImport: false, 36 | ignoreExport: false, 37 | }], 38 | 'no-var': 'error', 39 | 'object-shorthand': ['error', 'always', { 40 | ignoreConstructors: false, 41 | avoidQuotes: true, 42 | }], 43 | 'prefer-arrow-callback': ['error', { 44 | allowNamedFunctions: false, 45 | allowUnboundThis: true, 46 | }], 47 | 'prefer-destructuring': ['error', { 48 | VariableDeclarator: { 49 | array: false, 50 | object: true, 51 | }, 52 | AssignmentExpression: { 53 | array: true, 54 | object: false, 55 | }, 56 | }, { 57 | enforceForRenamedProperties: false, 58 | }], 59 | 'prefer-numeric-literals': 'error', 60 | 'prefer-reflect': 'off', 61 | 'prefer-rest-params': 'error', 62 | 'require-yield': 'error', 63 | 'rest-spread-spacing': ['error', 'never'], 64 | 'sort-imports': ['off', { 65 | ignoreCase: false, 66 | ignoreDeclarationSort: false, 67 | ignoreMemberSort: false, 68 | memberSyntaxSortOrder: ['none', 'all', 'multiple', 'single'], 69 | }], 70 | 'symbol-description': 'error', 71 | 'yield-star-spacing': ['error', 'after'], 72 | } 73 | }; 74 | -------------------------------------------------------------------------------- /react-a11y.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | plugins: [ 3 | 'jsx-a11y', 4 | 'react', 5 | ], 6 | ignorePatterns: ['*.html', '*.svelte'], 7 | parserOptions: { 8 | ecmaFeatures: { 9 | jsx: true, 10 | }, 11 | }, 12 | rules: { 13 | 'jsx-a11y/anchor-has-content': ['error', { components: [] }], 14 | 'jsx-a11y/aria-role': ['error', { ignoreNonDom: false }], 15 | 'jsx-a11y/aria-props': 'error', 16 | 'jsx-a11y/aria-proptypes': 'error', 17 | 'jsx-a11y/aria-unsupported-elements': 'error', 18 | 'jsx-a11y/alt-text': ['error', { 19 | elements: ['img', 'object', 'area', 'input[type="image"]'], 20 | img: [], 21 | object: [], 22 | area: [], 23 | 'input[type="image"]': [], 24 | }], 25 | 'jsx-a11y/img-redundant-alt': 0, 26 | 'jsx-a11y/label-has-for': ['off', { 27 | components: [], 28 | required: { 29 | every: ['nesting', 'id'], 30 | }, 31 | allowChildren: false, 32 | }], 33 | 'jsx-a11y/label-has-associated-control': ['error', { 34 | labelComponents: [], 35 | labelAttributes: [], 36 | controlComponents: [], 37 | assert: 'both', 38 | depth: 25 39 | }], 40 | 'jsx-a11y/control-has-associated-label': ['error', { 41 | labelAttributes: ['label'], 42 | controlComponents: [], 43 | ignoreElements: [ 44 | 'audio', 45 | 'canvas', 46 | 'embed', 47 | 'input', 48 | 'textarea', 49 | 'tr', 50 | 'video', 51 | ], 52 | ignoreRoles: [ 53 | 'grid', 54 | 'listbox', 55 | 'menu', 56 | 'menubar', 57 | 'radiogroup', 58 | 'row', 59 | 'tablist', 60 | 'toolbar', 61 | 'tree', 62 | 'treegrid', 63 | ], 64 | depth: 5, 65 | }], 66 | 'jsx-a11y/mouse-events-have-key-events': 'error', 67 | 'jsx-a11y/no-access-key': 'error', 68 | 'jsx-a11y/no-onchange': 'off', 69 | 'jsx-a11y/interactive-supports-focus': 'error', 70 | 'jsx-a11y/role-has-required-aria-props': 'error', 71 | 'jsx-a11y/role-supports-aria-props': 'error', 72 | 'jsx-a11y/tabindex-no-positive': 'error', 73 | 'jsx-a11y/heading-has-content': ['error', { components: [''] }], 74 | 'jsx-a11y/html-has-lang': 'error', 75 | 'jsx-a11y/lang': 'error', 76 | 'jsx-a11y/no-distracting-elements': ['error', { 77 | elements: ['marquee', 'blink'], 78 | }], 79 | 'jsx-a11y/scope': 'error', 80 | 'jsx-a11y/click-events-have-key-events': 'error', 81 | 'jsx-a11y/no-static-element-interactions': ['error', { 82 | handlers: [ 83 | 'onClick', 84 | 'onMouseDown', 85 | 'onMouseUp', 86 | 'onKeyPress', 87 | 'onKeyDown', 88 | 'onKeyUp', 89 | ] 90 | }], 91 | 'jsx-a11y/no-noninteractive-element-interactions': ['error', { 92 | handlers: [ 93 | 'onClick', 94 | 'onMouseDown', 95 | 'onMouseUp', 96 | 'onKeyPress', 97 | 'onKeyDown', 98 | 'onKeyUp', 99 | ] 100 | }], 101 | 'jsx-a11y/accessible-emoji': 'error', 102 | 'jsx-a11y/aria-activedescendant-has-tabindex': 'error', 103 | 'jsx-a11y/iframe-has-title': 'error', 104 | 'jsx-a11y/no-autofocus': ['error', { ignoreNonDOM: true }], 105 | 'jsx-a11y/no-redundant-roles': 'error', 106 | 'jsx-a11y/media-has-caption': ['error', { 107 | audio: [], 108 | video: [], 109 | track: [], 110 | }], 111 | 'jsx-a11y/no-interactive-element-to-noninteractive-role': ['error', { 112 | tr: ['none', 'presentation'], 113 | }], 114 | 'jsx-a11y/no-noninteractive-element-to-interactive-role': ['error', { 115 | ul: ['listbox', 'menu', 'menubar', 'radiogroup', 'tablist', 'tree', 'treegrid'], 116 | ol: ['listbox', 'menu', 'menubar', 'radiogroup', 'tablist', 'tree', 'treegrid'], 117 | li: ['menuitem', 'option', 'row', 'tab', 'treeitem'], 118 | table: ['grid'], 119 | td: ['gridcell'], 120 | }], 121 | 'jsx-a11y/no-noninteractive-tabindex': ['error', { 122 | tags: [], 123 | roles: ['tabpanel'], 124 | }], 125 | 'jsx-a11y/anchor-is-valid': ['error', { 126 | components: ['Link'], 127 | specialLink: ['to'], 128 | aspects: ['noHref', 'invalidHref', 'preferButton'], 129 | }], 130 | }, 131 | }; 132 | -------------------------------------------------------------------------------- /import.js: -------------------------------------------------------------------------------- 1 | 2 | module.exports = { 3 | env: { 4 | es6: true, 5 | }, 6 | parserOptions: { 7 | ecmaVersion: 6, 8 | sourceType: 'module', 9 | }, 10 | plugins: [ 11 | 'import', 12 | ], 13 | settings: { 14 | 'import/resolver': { 15 | node: { 16 | extensions: ['.mjs', '.js', '.json'], 17 | } 18 | }, 19 | 'import/extensions': [ 20 | '.js', 21 | '.mjs', 22 | '.jsx', 23 | ], 24 | 'import/core-modules': [ 25 | ], 26 | 'import/ignore': [ 27 | 'node_modules', 28 | '\\.(coffee|scss|css|less|hbs|svg|json)$', 29 | ], 30 | }, 31 | rules: { 32 | 'import/no-unresolved': ['error', { commonjs: true, caseSensitive: true }], 33 | 'import/named': 'error', 34 | 'import/default': 'off', 35 | 'import/namespace': 'off', 36 | 'import/export': 'error', 37 | 'import/no-named-as-default': 'error', 38 | 'import/no-named-as-default-member': 'error', 39 | 'import/no-deprecated': 'off', 40 | 'import/no-extraneous-dependencies': ['error', { 41 | devDependencies: [ 42 | '**/test/**/*.js', 43 | '**/client/**/*.js', 44 | 'test/**', // tape, common npm pattern 45 | 'tests/**', // also common npm pattern 46 | 'spec/**', // mocha, rspec-like pattern 47 | '**/__tests__/**', // jest pattern 48 | '**/__mocks__/**', // jest pattern 49 | 'test.{js,jsx}', // repos with a single test file 50 | 'test-*.{js,jsx}', // repos with multiple top-level test files 51 | '**/*{.,_}{test,spec}.{js,jsx}', // tests where the extension or filename suffix denotes that it is a test 52 | '**/jest.config.js', // jest config 53 | '**/jest.setup.js', // jest setup 54 | '**/vue.config.js', // vue-cli config 55 | '**/webpack.config.js', // webpack config 56 | '**/webpack.config.*.js', // webpack config 57 | '**/rollup.config.js', // rollup config 58 | '**/rollup.config.*.js', // rollup config 59 | '**/gulpfile.js', // gulp config 60 | '**/gulpfile.*.js', // gulp config 61 | '**/Gruntfile{,.js}', // grunt config 62 | '**/protractor.conf.js', // protractor config 63 | '**/protractor.conf.*.js', // protractor config 64 | ], 65 | optionalDependencies: false, 66 | }], 67 | 'import/no-mutable-exports': 'error', 68 | 'import/no-commonjs': 'off', 69 | 'import/no-amd': 'error', 70 | 'import/no-nodejs-modules': 'off', 71 | 'import/first': 'error', 72 | 'import/imports-first': 'off', 73 | 'import/no-duplicates': 'error', 74 | 'import/no-namespace': 'off', 75 | 'import/extensions': ['error', 'ignorePackages', { 76 | js: 'never', 77 | mjs: 'never', 78 | jsx: 'never', 79 | }], 80 | 'import/order': ['error', { groups: [['builtin', 'external', 'internal']] }], 81 | 'import/newline-after-import': 'error', 82 | 'import/prefer-default-export': 'error', 83 | 'import/no-restricted-paths': 'off', 84 | 'import/max-dependencies': ['off', { max: 10 }], 85 | 'import/no-absolute-path': 'error', 86 | 'import/no-dynamic-require': 'error', 87 | 'import/no-internal-modules': ['off', { 88 | allow: [], 89 | }], 90 | 'import/unambiguous': 'off', 91 | 'import/no-webpack-loader-syntax': 'error', 92 | 'import/no-unassigned-import': 'off', 93 | 'import/no-named-default': 'error', 94 | 'import/no-anonymous-default-export': ['off', { 95 | allowArray: false, 96 | allowArrowFunction: false, 97 | allowAnonymousClass: false, 98 | allowAnonymousFunction: false, 99 | allowLiteral: false, 100 | allowObject: false, 101 | }], 102 | 'import/exports-last': 'off', 103 | 'import/group-exports': 'off', 104 | 'import/no-default-export': 'off', 105 | 'import/no-named-export': 'off', 106 | 'import/no-self-import': 'error', 107 | 'import/no-cycle': ['error', { maxDepth: Infinity }], 108 | 'import/no-useless-path-segments': 'error', 109 | 'import/dynamic-import-chunkname': ['off', { 110 | importFunctions: [], 111 | webpackChunknameFormat: '[0-9a-zA-Z-_/.]+', 112 | }], 113 | 'import/no-relative-parent-imports': 'off', 114 | 'import/no-unused-modules': ['off', { 115 | ignoreExports: [], 116 | missingExports: true, 117 | unusedExports: true, 118 | }], 119 | }, 120 | }; 121 | -------------------------------------------------------------------------------- /react.js: -------------------------------------------------------------------------------- 1 | 2 | module.exports = { 3 | plugins: [ 4 | 'react', 5 | ], 6 | ignorePatterns: ['*.html', '*.svelte'], 7 | parserOptions: { 8 | ecmaFeatures: { 9 | jsx: true, 10 | }, 11 | }, 12 | rules: { 13 | 'jsx-quotes': 0, 14 | 'class-methods-use-this': ['error', { 15 | exceptMethods: [ 16 | 'render', 17 | 'getInitialState', 18 | 'getDefaultProps', 19 | 'getChildContext', 20 | 'componentWillMount', 21 | 'UNSAFE_componentWillMount', 22 | 'componentDidMount', 23 | 'componentWillReceiveProps', 24 | 'UNSAFE_componentWillReceiveProps', 25 | 'shouldComponentUpdate', 26 | 'componentWillUpdate', 27 | 'UNSAFE_componentWillUpdate', 28 | 'componentDidUpdate', 29 | 'componentWillUnmount', 30 | 'componentDidCatch', 31 | 'getSnapshotBeforeUpdate', 32 | ], 33 | }], 34 | 'react/display-name': ['off', { ignoreTranspilerName: false }], 35 | 'react/forbid-prop-types': 0, 36 | 'react/forbid-dom-props': ['off', { forbid: [] }], 37 | 'react/jsx-boolean-value': 0, 38 | 'react/jsx-closing-bracket-location': 0, 39 | 'react/jsx-closing-tag-location': 0, 40 | 'react/jsx-curly-spacing': 0, 41 | 'react/jsx-handler-names': ['off', { 42 | eventHandlerPrefix: 'handle', 43 | eventHandlerPropPrefix: 'on', 44 | }], 45 | 'react/jsx-indent-props': 0, 46 | 'react/jsx-key': ['error'], 47 | 'react/jsx-max-props-per-line': 0, 48 | 'react/jsx-no-bind': ['error', { 49 | ignoreRefs: true, 50 | allowArrowFunctions: true, 51 | allowFunctions: false, 52 | allowBind: false, 53 | ignoreDOMComponents: true, 54 | }], 55 | 'react/jsx-no-duplicate-props': ['error', { ignoreCase: true }], 56 | 'react/jsx-no-literals': ['off', { noStrings: true }], 57 | 'react/jsx-no-undef': 'error', 58 | 'react/jsx-pascal-case': ['error', { 59 | allowAllCaps: true, 60 | ignore: [], 61 | }], 62 | 'react/sort-prop-types': ['off', { 63 | ignoreCase: true, 64 | callbacksLast: false, 65 | requiredFirst: false, 66 | sortShapeProp: true, 67 | }], 68 | 'react/jsx-sort-prop-types': 'off', 69 | 'react/jsx-sort-props': ['off', { 70 | ignoreCase: true, 71 | callbacksLast: false, 72 | shorthandFirst: false, 73 | shorthandLast: false, 74 | noSortAlphabetically: false, 75 | reservedFirst: true, 76 | }], 77 | 'react/jsx-sort-default-props': ['off', { 78 | ignoreCase: true, 79 | }], 80 | 'react/jsx-uses-react': ['error'], 81 | 'react/jsx-uses-vars': 'error', 82 | 'react/no-danger': 0, 83 | 'react/no-deprecated': ['error'], 84 | 'react/no-did-mount-set-state': 'off', 85 | 'react/no-did-update-set-state': 'error', 86 | 'react/no-will-update-set-state': 'error', 87 | 'react/no-direct-mutation-state': ['error'], 88 | 'react/no-is-mounted': 'error', 89 | 'react/no-multi-comp': 0, 90 | 'react/no-set-state': 'off', 91 | 'react/no-string-refs': 'error', 92 | 'react/no-unknown-property': 'error', 93 | 'react/prefer-es6-class': ['error', 'always'], 94 | 'react/prefer-stateless-function': ['error', { ignorePureComponents: true }], 95 | 'react/prop-types': ['error', { 96 | ignore: [], 97 | customValidators: [], 98 | skipUndeclared: false 99 | }], 100 | 'react/react-in-jsx-scope': 'error', 101 | 'react/require-render-return': 'error', 102 | 'react/self-closing-comp': 'error', 103 | 'react/sort-comp': 0, 104 | 'react/jsx-wrap-multilines': 0, 105 | 'react/jsx-first-prop-new-line': 0, 106 | 'react/jsx-equals-spacing': ['error', 'never'], 107 | 'react/jsx-indent': 0, 108 | 'react/jsx-no-target-blank': 0, 109 | 'react/jsx-filename-extension': 0, 110 | 'react/jsx-no-comment-textnodes': 'error', 111 | 'react/no-render-return-value': 'error', 112 | 'react/require-optimization': ['off', { allowDecorators: [] }], 113 | 'react/no-find-dom-node': 'error', 114 | 'react/forbid-component-props': ['off', { forbid: [] }], 115 | 'react/forbid-elements': ['off', { forbid: [], }], 116 | 'react/no-danger-with-children': 'error', 117 | 'react/no-unused-prop-types': ['error', { 118 | customValidators: [ 119 | ], 120 | skipShapeProps: true, 121 | }], 122 | 'react/style-prop-object': 'error', 123 | 'react/no-unescaped-entities': 'error', 124 | 'react/no-children-prop': 'error', 125 | 'react/jsx-tag-spacing': ['error', { 126 | closingSlash: 'never', 127 | beforeSelfClosing: 'allow', 128 | afterOpening: 'never', 129 | beforeClosing: 'never', 130 | }], 131 | 'react/jsx-space-before-closing': 0, 132 | 'react/no-array-index-key': 'error', 133 | 'react/require-default-props': ['error', { 134 | forbidDefaultForRequired: true, 135 | }], 136 | 'react/forbid-foreign-prop-types': ['warn', { allowInPropTypes: true }], 137 | 'react/void-dom-elements-no-children': 'error', 138 | 'react/default-props-match-prop-types': ['error', { allowRequiredDefaults: false }], 139 | 'react/no-redundant-should-component-update': 'error', 140 | 'react/no-unused-state': 'error', 141 | 'react/boolean-prop-naming': ['off', { 142 | propTypeNames: ['bool', 'mutuallyExclusiveTrueProps'], 143 | rule: '^(is|has)[A-Z]([A-Za-z0-9]?)+', 144 | message: '', 145 | }], 146 | 'react/no-typos': 'error', 147 | 'react/jsx-curly-brace-presence': ['error', { props: 'never', children: 'never' }], 148 | 'react/destructuring-assignment': 0, 149 | 'react/no-access-state-in-setstate': 'error', 150 | 'react/button-has-type': ['error', { 151 | button: true, 152 | submit: true, 153 | reset: false, 154 | }], 155 | 'react/jsx-child-element-spacing': 'off', 156 | 'react/no-this-in-sfc': 'error', 157 | 'react/jsx-max-depth': 'off', 158 | 'react/jsx-props-no-multi-spaces': 'error', 159 | 'react/no-unsafe': 'off', 160 | 'react/jsx-fragments': ['error', 'syntax'], 161 | 'react/jsx-curly-newline': ['error', { 162 | multiline: 'consistent', 163 | singleline: 'consistent', 164 | }], 165 | 'react/state-in-constructor': ['error', 'always'], 166 | 'react/static-property-placement': ['error', 'property assignment'], 167 | 'react/jsx-props-no-spreading': 0, 168 | 'react/prefer-read-only-props': 'off', 169 | }, 170 | settings: { 171 | 'import/resolver': { 172 | node: { 173 | extensions: ['.js', '.jsx', '.json'], 174 | } 175 | }, 176 | react: { 177 | pragma: 'React', 178 | version: 'detect', 179 | }, 180 | propWrapperFunctions: [ 181 | 'forbidExtraProps', // https://www.npmjs.com/package/airbnb-prop-types 182 | 'exact', // https://www.npmjs.com/package/prop-types-exact 183 | 'Object.freeze', // https://tc39.github.io/ecma262/#sec-object.freeze 184 | ], 185 | } 186 | }; 187 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "{}" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright {yyyy} {name of copyright owner} 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. 202 | -------------------------------------------------------------------------------- /index.js: -------------------------------------------------------------------------------- 1 | 2 | let confusingBrowserGlobals = require('confusing-browser-globals'); 3 | 4 | module.exports = { 5 | extends: [ 6 | './node', 7 | './es6', 8 | './import', 9 | './react', 10 | './react-hooks', 11 | './react-a11y', 12 | ], 13 | env: { 14 | browser: true, 15 | mocha: true, 16 | jest: true, 17 | node: true, 18 | }, 19 | parserOptions: { 20 | ecmaVersion: 2018, 21 | sourceType: 'module', 22 | }, 23 | rules: { 24 | 'array-bracket-newline': ['off', 'consistent'], // object option alternative: { multiline: true, minItems: 3 } 25 | 'array-element-newline': ['off', { multiline: true, minItems: 3 }], 26 | 'array-bracket-spacing': ['error', 'never'], 27 | 'block-spacing': ['error', 'always'], 28 | camelcase: ['error', { properties: 'never', ignoreDestructuring: false }], 29 | 'capitalized-comments': ['off', 'never', { 30 | line: { 31 | ignorePattern: '.*', 32 | ignoreInlineComments: true, 33 | ignoreConsecutiveComments: true, 34 | }, 35 | block: { 36 | ignorePattern: '.*', 37 | ignoreInlineComments: true, 38 | ignoreConsecutiveComments: true, 39 | }, 40 | }], 41 | 'comma-spacing': ['error', { before: false, after: true }], 42 | 'computed-property-spacing': ['error', 'never'], 43 | 'consistent-this': 'off', 44 | 'eol-last': ['error', 'always'], 45 | 'func-call-spacing': ['error', 'never'], 46 | 'func-name-matching': ['off', 'always', { 47 | includeCommonJSModuleExports: false, 48 | considerPropertyDescriptor: true, 49 | }], 50 | 'func-style': ['off', 'expression'], 51 | 'function-paren-newline': ['error', 'consistent'], 52 | 'id-blacklist': 'off', 53 | 'id-length': 'off', 54 | 'id-match': 'off', 55 | 'implicit-arrow-linebreak': ['error', 'beside'], 56 | 'keyword-spacing': ['error', { 57 | before: true, 58 | after: true, 59 | overrides: { 60 | return: { after: true }, 61 | throw: { after: true }, 62 | case: { after: true } 63 | } 64 | }], 65 | 'line-comment-position': ['off', { 66 | position: 'above', 67 | ignorePattern: '', 68 | applyDefaultPatterns: true, 69 | }], 70 | 'linebreak-style': ['error', 'unix'], 71 | 'lines-between-class-members': 'off', 72 | 'lines-around-comment': 'off', 73 | 'lines-around-directive': ['error', { 74 | before: 'always', 75 | after: 'always', 76 | }], 77 | 'max-depth': ['off', 4], 78 | 'max-len': ['error', 100, 2, { 79 | ignoreUrls: true, 80 | ignoreComments: false, 81 | ignoreRegExpLiterals: true, 82 | ignoreStrings: true, 83 | ignoreTemplateLiterals: true, 84 | }], 85 | 'max-lines': ['off', { 86 | max: 300, 87 | skipBlankLines: true, 88 | skipComments: true 89 | }], 90 | 'max-lines-per-function': ['off', { 91 | max: 50, 92 | skipBlankLines: true, 93 | skipComments: true, 94 | IIFEs: true, 95 | }], 96 | 'max-nested-callbacks': 'off', 97 | 'max-params': ['off', 3], 98 | 'max-statements': ['off', 10], 99 | 'max-statements-per-line': ['off', { max: 1 }], 100 | 'multiline-comment-style': ['off', 'starred-block'], 101 | 'multiline-ternary': ['off', 'never'], 102 | 'new-parens': 'error', 103 | 'newline-after-var': 'off', 104 | 'newline-before-return': 'off', 105 | 'newline-per-chained-call': ['error', { ignoreChainWithDepth: 4 }], 106 | 'no-array-constructor': 'error', 107 | 'no-inline-comments': 'off', 108 | 'no-mixed-operators': ['error', { 109 | groups: [ 110 | ['%', '**'], 111 | ['%', '+'], 112 | ['%', '-'], 113 | ['%', '*'], 114 | ['%', '/'], 115 | ['/', '*'], 116 | ['&', '|', '<<', '>>', '>>>'], 117 | ['==', '!=', '===', '!=='], 118 | ['&&', '||'], 119 | ], 120 | allowSamePrecedence: false 121 | }], 122 | 'no-mixed-spaces-and-tabs': 'error', 123 | 'no-multi-assign': ['error'], 124 | 'no-multiple-empty-lines': ['error', { max: 2, maxBOF: 1, maxEOF: 0 }], 125 | 'no-negated-condition': 'off', 126 | 'no-nested-ternary': 'error', 127 | 'no-new-object': 'error', 128 | 'no-spaced-func': 'error', 129 | 'no-tabs': 'error', 130 | 'no-ternary': 'off', 131 | 'no-trailing-spaces': ['error', { 132 | skipBlankLines: false, 133 | ignoreComments: false, 134 | }], 135 | 'no-unneeded-ternary': ['error', { defaultAssignment: false }], 136 | 'no-whitespace-before-property': 'error', 137 | 'nonblock-statement-body-position': ['error', 'beside', { overrides: {} }], 138 | 'object-curly-spacing': ['error', 'always'], 139 | 'object-curly-newline': ['error', { 140 | ObjectExpression: { minProperties: 40, multiline: true, consistent: true }, 141 | ObjectPattern: { minProperties: 40, multiline: true, consistent: true }, 142 | ImportDeclaration: { minProperties: 40, multiline: true, consistent: true }, 143 | ExportDeclaration: { minProperties: 40, multiline: true, consistent: true }, 144 | }], 145 | 'object-property-newline': ['error', { 146 | allowAllPropertiesOnSameLine: true, 147 | }], 148 | 'one-var-declaration-per-line': ['error', 'always'], 149 | 'operator-assignment': ['error', 'always'], 150 | 'operator-linebreak': 0, 151 | 'padded-blocks': ['error', { 152 | blocks: 'never', 153 | classes: 'never', 154 | switches: 'never', 155 | }, { 156 | allowSingleLineBlocks: true, 157 | }], 158 | 'padding-line-between-statements': 'off', 159 | 'prefer-object-spread': 'error', 160 | 'quote-props': ['error', 'as-needed', { keywords: false, unnecessary: true, numbers: false }], 161 | 'require-jsdoc': 'off', 162 | semi: ['error', 'always'], 163 | 'sort-keys': ['off', 'asc', { caseSensitive: false, natural: true }], 164 | 'sort-vars': 'off', 165 | 'space-before-blocks': 'error', 166 | 'space-in-parens': ['error', 'never'], 167 | 'space-infix-ops': 'error', 168 | 'space-unary-ops': ['error', { 169 | words: true, 170 | nonwords: false, 171 | overrides: { 172 | }, 173 | }], 174 | 'spaced-comment': ['error', 'always', { 175 | line: { 176 | exceptions: ['-', '+'], 177 | markers: ['=', '!'], // space here to support sprockets directives 178 | }, 179 | block: { 180 | exceptions: ['-', '+'], 181 | markers: ['=', '!', ':', '::'], // space here to support sprockets directives and flow comment types 182 | balanced: true, 183 | } 184 | }], 185 | 'switch-colon-spacing': ['error', { after: true, before: false }], 186 | 'template-tag-spacing': ['error', 'never'], 187 | 'unicode-bom': ['error', 'never'], 188 | 'wrap-regex': 'off', 189 | 'init-declarations': 'off', 190 | 'no-catch-shadow': 'off', 191 | 'no-delete-var': 'error', 192 | 'no-label-var': 'error', 193 | 'no-restricted-globals': ['error', 'isFinite', 'isNaN'].concat(confusingBrowserGlobals), 194 | 'no-undef': 'error', 195 | 'no-undef-init': 'error', 196 | 'no-undefined': 'off', 197 | 'arrow-parens': 0, 198 | 'consistent-return': 0, 199 | 'no-param-reassign': 0, 200 | 'no-continue': 0, 201 | 'no-return-assign': 0, 202 | 'no-underscore-dangle': 0, 203 | 'prefer-spread': 0, 204 | 'class-methods-use-this': 0, 205 | 'no-constant-condition': ['error', { checkLoops: false }], 206 | 'no-shadow': ['error', { allow: ['err', 'error', 'res', 'resp', 'body'] }], 207 | 'no-unused-vars': ['error', { varsIgnorePattern: '(^h$)' }], 208 | 'no-bitwise': ['error', { allow: ['~'] }], 209 | 'no-cond-assign': ['error', 'except-parens'], 210 | 'prefer-const': 0, 211 | 'prefer-template': 0, 212 | 'func-names': 0, 213 | 'no-console': ['warn', { allow: ['error', 'warn'] }], 214 | 'new-cap': 0, 215 | 'space-before-function-paren': 0, 216 | 'one-var': 0, 217 | // in practice, people indent responsibly - this rule is too inflexible for many justified cases 218 | indent: 0, 219 | quotes: ['error', 'single', { avoidEscape: true, allowTemplateLiterals: true }], 220 | 'comma-style': ['error', 'last', { exceptions: { VariableDeclaration: true } }], 221 | 'no-restricted-syntax': ['error', 'WithStatement'], 222 | 'no-use-before-define': 0, 223 | 'brace-style': 0, 224 | 'key-spacing': ['error', { beforeColon: false, afterColon: true, mode: 'minimum' }], 225 | 'no-multi-spaces': 0, 226 | 'comma-dangle': 0, 227 | 'no-confusing-arrow': 0, 228 | 'template-curly-spacing': 0, 229 | 'no-plusplus': 0, 230 | strict: ['error', 'never'], 231 | 'for-direction': 'error', 232 | 'getter-return': ['error', { allowImplicit: true }], 233 | 'no-async-promise-executor': 'error', 234 | 'no-await-in-loop': 'error', 235 | 'no-compare-neg-zero': 'error', 236 | 'no-control-regex': 'error', 237 | 'no-debugger': 'error', 238 | 'no-dupe-args': 'error', 239 | 'no-dupe-keys': 'error', 240 | 'no-duplicate-case': 'error', 241 | 'no-empty': ['error', { allowEmptyCatch: true }], 242 | 'no-empty-character-class': 'error', 243 | 'no-ex-assign': 'error', 244 | 'no-extra-boolean-cast': 'error', 245 | 'no-extra-parens': ['off', 'all', { 246 | conditionalAssign: true, 247 | nestedBinaryExpressions: false, 248 | returnAssign: false, 249 | ignoreJSX: 'all', // delegate to eslint-plugin-react 250 | enforceForArrowConditionals: false, 251 | }], 252 | 'no-extra-semi': 'error', 253 | 'no-func-assign': 'error', 254 | 'no-inner-declarations': 'error', 255 | 'no-invalid-regexp': 'error', 256 | 'no-irregular-whitespace': 'error', 257 | 'no-misleading-character-class': 'error', 258 | 'no-obj-calls': 'error', 259 | 'no-prototype-builtins': 'error', 260 | 'no-regex-spaces': 'error', 261 | 'no-sparse-arrays': 'error', 262 | 'no-template-curly-in-string': 'error', 263 | 'no-unexpected-multiline': 'error', 264 | 'no-unreachable': 'error', 265 | 'no-unsafe-finally': 'error', 266 | 'no-unsafe-negation': 'error', 267 | 'no-negated-in-lhs': 'off', 268 | 'require-atomic-updates': 'off', 269 | 'use-isnan': 'error', 270 | 'valid-jsdoc': 'off', 271 | 'valid-typeof': ['error', { requireStringLiterals: true }], 272 | 'accessor-pairs': 'off', 273 | 'array-callback-return': ['error', { allowImplicit: true }], 274 | 'block-scoped-var': 'error', 275 | complexity: ['off', 11], 276 | curly: ['error', 'multi-line'], 277 | 'default-case': ['error', { commentPattern: '^no default$' }], 278 | 'dot-notation': ['error', { allowKeywords: true }], 279 | 'dot-location': ['error', 'property'], 280 | eqeqeq: ['error', 'always', { null: 'ignore' }], 281 | 'guard-for-in': 'error', 282 | 'max-classes-per-file': 'off', 283 | 'no-alert': 'warn', 284 | 'no-caller': 'error', 285 | 'no-case-declarations': 'error', 286 | 'no-div-regex': 'off', 287 | 'no-else-return': ['error', { allowElseIf: false }], 288 | 'no-empty-function': ['error', { 289 | allow: [ 290 | 'arrowFunctions', 291 | 'functions', 292 | 'methods', 293 | ] 294 | }], 295 | 'no-empty-pattern': 'error', 296 | 'no-eq-null': 'off', 297 | 'no-eval': 'error', 298 | 'no-extend-native': 'error', 299 | 'no-extra-bind': 'error', 300 | 'no-extra-label': 'error', 301 | 'no-fallthrough': 'error', 302 | 'no-floating-decimal': 'error', 303 | 'no-global-assign': ['error', { exceptions: [] }], 304 | 'no-native-reassign': 'off', 305 | 'no-implicit-coercion': ['off', { 306 | boolean: false, 307 | number: true, 308 | string: true, 309 | allow: [], 310 | }], 311 | 'no-implicit-globals': 'off', 312 | 'no-implied-eval': 'error', 313 | 'no-invalid-this': 'off', 314 | 'no-iterator': 'error', 315 | 'no-labels': ['error', { allowLoop: false, allowSwitch: false }], 316 | 'no-lone-blocks': 'error', 317 | 'no-loop-func': 'error', 318 | 'no-magic-numbers': ['off', { 319 | ignore: [], 320 | ignoreArrayIndexes: true, 321 | enforceConst: true, 322 | detectObjects: false, 323 | }], 324 | 'no-multi-str': 'error', 325 | 'no-new': 'error', 326 | 'no-new-func': 'error', 327 | 'no-new-wrappers': 'error', 328 | 'no-octal': 'error', 329 | 'no-octal-escape': 'error', 330 | 'no-proto': 'error', 331 | 'no-redeclare': 'error', 332 | 'no-restricted-properties': ['error', { 333 | object: 'arguments', 334 | property: 'callee', 335 | message: 'arguments.callee is deprecated', 336 | }, { 337 | object: 'global', 338 | property: 'isFinite', 339 | message: 'Please use Number.isFinite instead', 340 | }, { 341 | object: 'self', 342 | property: 'isFinite', 343 | message: 'Please use Number.isFinite instead', 344 | }, { 345 | object: 'window', 346 | property: 'isFinite', 347 | message: 'Please use Number.isFinite instead', 348 | }, { 349 | object: 'global', 350 | property: 'isNaN', 351 | message: 'Please use Number.isNaN instead', 352 | }, { 353 | object: 'self', 354 | property: 'isNaN', 355 | message: 'Please use Number.isNaN instead', 356 | }, { 357 | object: 'window', 358 | property: 'isNaN', 359 | message: 'Please use Number.isNaN instead', 360 | }, { 361 | property: '__defineGetter__', 362 | message: 'Please use Object.defineProperty instead.', 363 | }, { 364 | property: '__defineSetter__', 365 | message: 'Please use Object.defineProperty instead.', 366 | }, { 367 | object: 'Math', 368 | property: 'pow', 369 | message: 'Use the exponentiation operator (**) instead.', 370 | }], 371 | 'no-return-await': 'error', 372 | 'no-script-url': 'error', 373 | 'no-self-assign': ['error', { 374 | props: true, 375 | }], 376 | 'no-self-compare': 'error', 377 | 'no-sequences': 'error', 378 | 'no-throw-literal': 'error', 379 | 'no-unmodified-loop-condition': 'off', 380 | 'no-unused-expressions': ['error', { 381 | allowShortCircuit: false, 382 | allowTernary: false, 383 | allowTaggedTemplates: false, 384 | }], 385 | 'no-unused-labels': 'error', 386 | 'no-useless-call': 'off', 387 | 'no-useless-catch': 'error', 388 | 'no-useless-concat': 'error', 389 | 'no-useless-escape': 'error', 390 | 'no-useless-return': 'error', 391 | 'no-void': 'error', 392 | 'no-warning-comments': ['off', { terms: ['todo', 'fixme', 'xxx'], location: 'start' }], 393 | 'no-with': 'error', 394 | 'prefer-promise-reject-errors': ['error', { allowEmptyReject: true }], 395 | 'prefer-named-capture-group': 'off', 396 | radix: 'error', 397 | 'require-await': 'off', 398 | 'require-unicode-regexp': 'off', 399 | 'vars-on-top': 'error', 400 | 'wrap-iife': ['error', 'outside', { functionPrototypeMethods: false }], 401 | yoda: 'error', 402 | } 403 | }; 404 | --------------------------------------------------------------------------------