diff --git a/index.js b/index.js index 5913de7..5ca6958 100644 --- a/index.js +++ b/index.js @@ -63,55 +63,55 @@ module.exports = { 'no-param-reassign': 'error', 'no-proto': 'error', 'no-restricted-properties': 'error', - 'no-return-assign': null, // https://eslint.org/docs/rules/no-return-assign // disallow assignment operators in `return` statements + 'no-return-assign': ['error', 'except-parens'], 'no-return-await': 'error', - 'no-script-url': null, // https://eslint.org/docs/rules/no-script-url // disallow `javascript:` urls + 'no-script-url': 'error', 'no-self-compare': 'error', - 'no-sequences': null, // https://eslint.org/docs/rules/no-sequences // disallow comma operators - 'no-throw-literal': null, // https://eslint.org/docs/rules/no-throw-literal // disallow throwing literals as exceptions - 'no-unmodified-loop-condition': null, // https://eslint.org/docs/rules/no-unmodified-loop-condition // disallow unmodified loop conditions + 'no-sequences': 'error', + 'no-throw-literal': 'error', + 'no-unmodified-loop-condition': 'error', 'no-unused-expressions': 'error', - 'no-useless-call': null, // https://eslint.org/docs/rules/no-useless-call // disallow unnecessary calls to `.call()` and `.apply()` + 'no-useless-call': 'error', 'no-useless-concat': 'error', 'no-useless-return': 'error', - 'no-void': null, // https://eslint.org/docs/rules/no-void // disallow `void` operators - 'no-warning-comments': null, // https://eslint.org/docs/rules/no-warning-comments // disallow specified warning terms in comments - 'prefer-named-capture-group': null, // https://eslint.org/docs/rules/prefer-named-capture-group // enforce using named capture group in regular expression - 'prefer-promise-reject-errors': null, // https://eslint.org/docs/rules/prefer-promise-reject-errors // require using Error objects as Promise rejection reasons - 'prefer-regex-literals': null, // https://eslint.org/docs/rules/prefer-regex-literals // disallow use of the `RegExp` constructor in favor of regular expression literals - radix: '', // enforce the consistent use of the radix argument when using `parseInt()` + 'no-void': 'error', + 'no-warning-comments': 'warn', + 'prefer-named-capture-group': 'warn', + 'prefer-promise-reject-errors': 'error', + 'prefer-regex-literals': 'error', + radix: ['error', 'as-needed'], 'require-await': 'error', - 'require-unicode-regexp': null, // https://eslint.org/docs/rules/require-unicode-regexp // enforce the use of `u` flag on RegExp + 'require-unicode-regexp': 'error', 'vars-on-top': 'error', - 'wrap-iife': null, // https://eslint.org/docs/rules/wrap-iife // require parentheses around immediate `function` invocations - yoda: '', // require or disallow "Yoda" conditions - // ## Strict Mode - // These rules relate to strict mode directives: + 'wrap-iife': ['error', 'inside'], + yoda: ['error', 'always', { exceptRange: true }], + + // Strict Mode https://eslint.org/docs/rules/#strict-mode strict: ['error', 'safe'], - // ## Variables - // These rules relate to variable declarations: - 'init-declarations': null, // https://eslint.org/docs/rules/init-declarations // require or disallow initialization in variable declarations - 'no-label-var': null, // https://eslint.org/docs/rules/no-label-var // disallow labels that share a name with a variable - 'no-restricted-globals': null, // https://eslint.org/docs/rules/no-restricted-globals // disallow specified global variables - 'no-shadow': null, // https://eslint.org/docs/rules/no-shadow // disallow variable declarations from shadowing variables declared in the outer scope - 'no-undef-init': null, // https://eslint.org/docs/rules/no-undef-init // disallow initializing variables to `undefined` - 'no-undefined': null, // https://eslint.org/docs/rules/no-undefined // disallow the use of `undefined` as an identifier - 'no-use-before-define': null, // https://eslint.org/docs/rules/no-use-before-define // disallow the use of variables before they are defined - // ## Node.js and CommonJS - // These rules relate to code running in Node.js, or in browsers with CommonJS: - 'callback-return': null, // https://eslint.org/docs/rules/callback-return // require `return` statements after callbacks - 'global-require': null, // https://eslint.org/docs/rules/global-require // require `require()` calls to be placed at top-level module scope - 'handle-callback-err': null, // https://eslint.org/docs/rules/handle-callback-err // require error handling in callbacks - 'no-buffer-constructor': null, // https://eslint.org/docs/rules/no-buffer-constructor // disallow use of the `Buffer()` constructor - 'no-mixed-requires': null, // https://eslint.org/docs/rules/no-mixed-requires // disallow `require` calls to be mixed with regular variable declarations - 'no-new-require': null, // https://eslint.org/docs/rules/no-new-require // disallow `new` operators with calls to `require` - 'no-path-concat': null, // https://eslint.org/docs/rules/no-path-concat // disallow string concatenation with `__dirname` and `__filename` - 'no-process-env': null, // https://eslint.org/docs/rules/no-process-env // disallow the use of `process.env` - 'no-process-exit': null, // https://eslint.org/docs/rules/no-process-exit // disallow the use of `process.exit()` - 'no-restricted-modules': null, // https://eslint.org/docs/rules/no-restricted-modules // disallow specified modules when loaded by `require` - 'no-sync': null, // https://eslint.org/docs/rules/no-sync // disallow synchronous methods - // ## Stylistic Issues - // These rules relate to style guidelines, and are therefore quite subjective: + + // Variables https://eslint.org/docs/rules/#variables + 'init-declarations': ['error', 'always'], + 'no-label-var': 'error', + 'no-restricted-globals': 'off', + 'no-shadow': ['error', { builtinGlobals: true, hoist: 'all' }], + 'no-undef-init': 'error', + 'no-undefined': 'error', + 'no-use-before-define': 'error', + + // Node.js and CommonJS https://eslint.org/docs/rules/#node-js-and-commonjs + 'callback-return': 'error', + 'global-require': 'error', + 'handle-callback-err': 'error', + 'no-buffer-constructor': 'error', + 'no-mixed-requires': 'error', + 'no-new-require': 'error', + 'no-path-concat': 'error', + 'no-process-env': 'warn', + 'no-process-exit': 'warn', + 'no-restricted-modules': 'off', + 'no-sync': ['error', { allowAtRootLevel: true }], + + // Stylistic Issues https://eslint.org/docs/rules/#stylistic-issues 'array-bracket-newline': null, // https://eslint.org/docs/rules/array-bracket-newline // enforce linebreaks after opening and before closing array brackets 'array-bracket-spacing': null, // https://eslint.org/docs/rules/array-bracket-spacing // enforce consistent spacing inside array brackets 'array-element-newline': null, // https://eslint.org/docs/rules/array-element-newline // enforce line breaks after each array element @@ -204,8 +204,8 @@ module.exports = { 'template-tag-spacing': null, // https://eslint.org/docs/rules/template-tag-spacing // require or disallow spacing between template tags and their literals 'unicode-bom': null, // https://eslint.org/docs/rules/unicode-bom // require or disallow Unicode byte order mark (BOM) 'wrap-regex': null, // https://eslint.org/docs/rules/wrap-regex // require parenthesis around regex literals - // ## ECMAScript 6 - // These rules relate to ES6, also known as ES2015: + + // ECMAScript 6 https://eslint.org/docs/rules/#ecmascript-6 'arrow-body-style': null, // https://eslint.org/docs/rules/arrow-body-style // require braces around arrow function bodies 'arrow-parens': null, // https://eslint.org/docs/rules/arrow-parens // require parentheses around arrow function arguments 'arrow-spacing': null, // https://eslint.org/docs/rules/arrow-spacing // enforce consistent spacing before and after the arrow in arrow functions