eslint-config-airbnb-base
Advanced tools
Comparing version 14.2.1 to 15.0.0
@@ -0,1 +1,20 @@ | ||
15.0.0 / 2021-11-08 | ||
================== | ||
- [breaking] drop eslint < 7, add eslint 8 (#2495) | ||
- [breaking] add `exports` | ||
- [patch] Improve `function-paren-newline` with `multiline-arguments` option (#2471) | ||
- [patch] update default value for complexity (#2420) | ||
- [patch] add disabled `no-unsafe-optional-chaining` rule | ||
- [patch] arthmetic -> arithmetic (#2341) | ||
- [patch] fix spelling of "than" (#2333) | ||
- [patch] add `no-nonoctal-decimal-escape` rule | ||
- [patch] `import/no-extraneous-dependencies`: Add .eslintrc.js to devDeps (#2329) | ||
- [guide] Spread operator => Spread syntax (#2423) | ||
- [guide] add references for eslint rules (#2419) | ||
- [Docs] HTTP => HTTPS (#2489) | ||
- [readme] some updates | ||
- [meta] use `prepublishOnly` script for npm 7+ | ||
- [deps] update `eslint-plugin-import`, `eslint-plugin-react`, `object.entries` | ||
- [dev deps] update `@babel/runtime`, ``tape` | ||
14.2.1 / 2020-11-06 | ||
@@ -2,0 +21,0 @@ ================== |
{ | ||
"name": "eslint-config-airbnb-base", | ||
"version": "14.2.1", | ||
"version": "15.0.0", | ||
"description": "Airbnb's base JS ESLint config, following our styleguide", | ||
"main": "index.js", | ||
"exports": { | ||
".": "./index.js", | ||
"./legacy": "./legacy.js", | ||
"./whitespace": "./whitespace.js", | ||
"./rules/best-practices": "./rules/best-practices.js", | ||
"./rules/es6": "./rules/es6.js", | ||
"./rules/node": "./rules/node.js", | ||
"./rules/style": "./rules/style.js", | ||
"./rules/errors": "./rules/errors.js", | ||
"./rules/imports": "./rules/imports.js", | ||
"./rules/strict": "./rules/strict.js", | ||
"./rules/variables": "./rules/variables.js", | ||
"./package.json": "./package.json" | ||
}, | ||
"scripts": { | ||
@@ -11,3 +25,4 @@ "prelint": "eclint check * rules/* test/*", | ||
"tests-only": "babel-tape-runner ./test/test-*.js", | ||
"prepublish": "(in-install || eslint-find-rules --unused) && (not-in-publish || npm test) && safe-publish-latest", | ||
"prepublishOnly": "eslint-find-rules --unused && npm test && safe-publish-latest", | ||
"prepublish": "not-in-publish || npm run prepublishOnly", | ||
"pretest": "npm run --silent lint", | ||
@@ -57,19 +72,19 @@ "test": "npm run --silent tests-only", | ||
"devDependencies": { | ||
"@babel/runtime": "^7.12.5", | ||
"@babel/runtime": "^7.16.0", | ||
"babel-preset-airbnb": "^4.5.0", | ||
"babel-tape-runner": "^3.0.0", | ||
"eclint": "^2.8.1", | ||
"eslint": "^5.16.0 || ^6.8.0 || ^7.2.0", | ||
"eslint-find-rules": "^3.6.1", | ||
"eslint-plugin-import": "^2.22.1", | ||
"eslint": "^7.32.0 || ^8.2.0", | ||
"eslint-find-rules": "^4.0.0", | ||
"eslint-plugin-import": "^2.25.2", | ||
"in-publish": "^2.0.1", | ||
"safe-publish-latest": "^1.1.4", | ||
"tape": "^5.0.1" | ||
"safe-publish-latest": "^2.0.0", | ||
"tape": "^5.3.1" | ||
}, | ||
"peerDependencies": { | ||
"eslint": "^5.16.0 || ^6.8.0 || ^7.2.0", | ||
"eslint-plugin-import": "^2.22.1" | ||
"eslint": "^7.32.0 || ^8.2.0", | ||
"eslint-plugin-import": "^2.25.2" | ||
}, | ||
"engines": { | ||
"node": ">= 6" | ||
"node": "^10.12.0 || >=12.0.0" | ||
}, | ||
@@ -79,4 +94,5 @@ "dependencies": { | ||
"object.assign": "^4.1.2", | ||
"object.entries": "^1.1.2" | ||
"object.entries": "^1.1.5", | ||
"semver": "^6.3.0" | ||
} | ||
} |
@@ -1,5 +0,9 @@ | ||
# eslint-config-airbnb-base | ||
# eslint-config-airbnb-base <sup>[![Version Badge][npm-version-svg]][package-url]</sup> | ||
[![npm version](https://badge.fury.io/js/eslint-config-airbnb-base.svg)](http://badge.fury.io/js/eslint-config-airbnb-base) | ||
[![npm version](https://badge.fury.io/js/eslint-config-airbnb-base.svg)][package-url] | ||
[![github actions][actions-image]][actions-url] | ||
[![License][license-image]][license-url] | ||
[![Downloads][downloads-image]][downloads-url] | ||
This package provides Airbnb's base JS .eslintrc (without React plugins) as an extensible shared config. | ||
@@ -82,3 +86,3 @@ | ||
```sh | ||
npm install --save-dev eslint-config-airbnb-base eslint@^3.0.1 eslint-plugin-import@^1.10.3 | ||
npm install --save-dev eslint-config-airbnb-base eslint@^#.#.# eslint-plugin-import@^#.#.# | ||
``` | ||
@@ -101,1 +105,10 @@ | ||
You can make sure this module lints with itself using `npm run lint`. | ||
[package-url]: https://npmjs.org/package/eslint-config-airbnb-base | ||
[npm-version-svg]: https://versionbadg.es/airbnb/javascript.svg | ||
[license-image]: https://img.shields.io/npm/l/eslint-config-airbnb-base.svg | ||
[license-url]: LICENSE.md | ||
[downloads-image]: https://img.shields.io/npm/dm/eslint-config-airbnb-base.svg | ||
[downloads-url]: https://npm-stat.com/charts.html?package=eslint-config-airbnb-base | ||
[actions-image]: https://img.shields.io/endpoint?url=https://github-actions-badge-u3jn4tfpocch.runkit.sh/airbnb/javascript | ||
[actions-url]: https://github.com/airbnb/javascript/actions |
module.exports = { | ||
rules: { | ||
// enforces getter/setter pairs in objects | ||
// https://eslint.org/docs/rules/accessor-pairs | ||
'accessor-pairs': 'off', | ||
@@ -11,6 +12,8 @@ | ||
// treat var statements as if they were block scoped | ||
// https://eslint.org/docs/rules/block-scoped-var | ||
'block-scoped-var': 'error', | ||
// specify the maximum cyclomatic complexity allowed in a program | ||
complexity: ['off', 11], | ||
// https://eslint.org/docs/rules/complexity | ||
complexity: ['off', 20], | ||
@@ -24,8 +27,11 @@ // enforce that class methods use "this" | ||
// require return statements to either always or never specify values | ||
// https://eslint.org/docs/rules/consistent-return | ||
'consistent-return': 'error', | ||
// specify curly brace conventions for all control statements | ||
// https://eslint.org/docs/rules/curly | ||
curly: ['error', 'multi-line'], // multiline | ||
// require default case in switch statements | ||
// https://eslint.org/docs/rules/default-case | ||
'default-case': ['error', { commentPattern: '^no default$' }], | ||
@@ -35,10 +41,9 @@ | ||
// https://eslint.org/docs/rules/default-case-last | ||
// TODO: enable, semver-minor, when eslint v7 is required (which is a major) | ||
'default-case-last': 'off', | ||
'default-case-last': 'error', | ||
// https://eslint.org/docs/rules/default-param-last | ||
// TODO: enable, semver-minor, when eslint v6.4 is required (which is a major) | ||
'default-param-last': 'off', | ||
'default-param-last': 'error', | ||
// encourages use of dot notation whenever possible | ||
// https://eslint.org/docs/rules/dot-notation | ||
'dot-notation': ['error', { allowKeywords: true }], | ||
@@ -56,6 +61,6 @@ | ||
// https://eslint.org/docs/rules/grouped-accessor-pairs | ||
// TODO: enable in next major, altho the guide forbids getters/setters anyways | ||
'grouped-accessor-pairs': 'off', | ||
'grouped-accessor-pairs': 'error', | ||
// make sure for-in loops have an if statement | ||
// https://eslint.org/docs/rules/guard-for-in | ||
'guard-for-in': 'error', | ||
@@ -68,9 +73,11 @@ | ||
// disallow the use of alert, confirm, and prompt | ||
// https://eslint.org/docs/rules/no-alert | ||
'no-alert': 'warn', | ||
// disallow use of arguments.caller or arguments.callee | ||
// https://eslint.org/docs/rules/no-caller | ||
'no-caller': 'error', | ||
// disallow lexical declarations in case/default clauses | ||
// https://eslint.org/docs/rules/no-case-declarations.html | ||
// https://eslint.org/docs/rules/no-case-declarations | ||
'no-case-declarations': 'error', | ||
@@ -80,4 +87,3 @@ | ||
// https://eslint.org/docs/rules/no-constructor-return | ||
// TODO: enable, semver-major | ||
'no-constructor-return': 'off', | ||
'no-constructor-return': 'error', | ||
@@ -107,11 +113,15 @@ // disallow division operators explicitly at beginning of regular expression | ||
// disallow comparisons to null without a type-checking operator | ||
// https://eslint.org/docs/rules/no-eq-null | ||
'no-eq-null': 'off', | ||
// disallow use of eval() | ||
// https://eslint.org/docs/rules/no-eval | ||
'no-eval': 'error', | ||
// disallow adding to native types | ||
// https://eslint.org/docs/rules/no-extend-native | ||
'no-extend-native': 'error', | ||
// disallow unnecessary function binding | ||
// https://eslint.org/docs/rules/no-extra-bind | ||
'no-extra-bind': 'error', | ||
@@ -124,5 +134,7 @@ | ||
// disallow fallthrough of case statements | ||
// https://eslint.org/docs/rules/no-fallthrough | ||
'no-fallthrough': 'error', | ||
// disallow the use of leading or trailing decimal points in numeric literals | ||
// https://eslint.org/docs/rules/no-floating-decimal | ||
'no-floating-decimal': 'error', | ||
@@ -133,3 +145,5 @@ | ||
'no-global-assign': ['error', { exceptions: [] }], | ||
// deprecated in favor of no-global-assign | ||
// https://eslint.org/docs/rules/no-native-reassign | ||
'no-native-reassign': 'off', | ||
@@ -151,17 +165,23 @@ | ||
// disallow use of eval()-like methods | ||
// https://eslint.org/docs/rules/no-implied-eval | ||
'no-implied-eval': 'error', | ||
// disallow this keywords outside of classes or class-like objects | ||
// https://eslint.org/docs/rules/no-invalid-this | ||
'no-invalid-this': 'off', | ||
// disallow usage of __iterator__ property | ||
// https://eslint.org/docs/rules/no-iterator | ||
'no-iterator': 'error', | ||
// disallow use of labels for anything other then loops and switches | ||
// disallow use of labels for anything other than loops and switches | ||
// https://eslint.org/docs/rules/no-labels | ||
'no-labels': ['error', { allowLoop: false, allowSwitch: false }], | ||
// disallow unnecessary nested blocks | ||
// https://eslint.org/docs/rules/no-lone-blocks | ||
'no-lone-blocks': 'error', | ||
// disallow creation of functions within loops | ||
// https://eslint.org/docs/rules/no-loop-func | ||
'no-loop-func': 'error', | ||
@@ -179,2 +199,3 @@ | ||
// disallow use of multiple spaces | ||
// https://eslint.org/docs/rules/no-multi-spaces | ||
'no-multi-spaces': ['error', { | ||
@@ -185,14 +206,23 @@ ignoreEOLComments: false, | ||
// disallow use of multiline strings | ||
// https://eslint.org/docs/rules/no-multi-str | ||
'no-multi-str': 'error', | ||
// disallow use of new operator when not part of the assignment or comparison | ||
// https://eslint.org/docs/rules/no-new | ||
'no-new': 'error', | ||
// disallow use of new operator for Function object | ||
// https://eslint.org/docs/rules/no-new-func | ||
'no-new-func': 'error', | ||
// disallows creating new instances of String, Number, and Boolean | ||
// https://eslint.org/docs/rules/no-new-wrappers | ||
'no-new-wrappers': 'error', | ||
// Disallow \8 and \9 escape sequences in string literals | ||
// https://eslint.org/docs/rules/no-nonoctal-decimal-escape | ||
'no-nonoctal-decimal-escape': 'error', | ||
// disallow use of (old style) octal literals | ||
// https://eslint.org/docs/rules/no-octal | ||
'no-octal': 'error', | ||
@@ -202,2 +232,3 @@ | ||
// var foo = 'Copyright \251'; | ||
// https://eslint.org/docs/rules/no-octal-escape | ||
'no-octal-escape': 'error', | ||
@@ -226,5 +257,7 @@ | ||
// disallow usage of __proto__ property | ||
// https://eslint.org/docs/rules/no-proto | ||
'no-proto': 'error', | ||
// disallow declaring the same variable more then once | ||
// disallow declaring the same variable more than once | ||
// https://eslint.org/docs/rules/no-redeclare | ||
'no-redeclare': 'error', | ||
@@ -275,8 +308,11 @@ | ||
// disallow use of assignment in return statement | ||
// https://eslint.org/docs/rules/no-return-assign | ||
'no-return-assign': ['error', 'always'], | ||
// disallow redundant `return await` | ||
// https://eslint.org/docs/rules/no-return-await | ||
'no-return-await': 'error', | ||
// disallow use of `javascript:` urls. | ||
// https://eslint.org/docs/rules/no-script-url | ||
'no-script-url': 'error', | ||
@@ -291,8 +327,11 @@ | ||
// disallow comparisons where both sides are exactly the same | ||
// https://eslint.org/docs/rules/no-self-compare | ||
'no-self-compare': 'error', | ||
// disallow use of comma operator | ||
// https://eslint.org/docs/rules/no-sequences | ||
'no-sequences': 'error', | ||
// restrict what can be thrown as an exception | ||
// https://eslint.org/docs/rules/no-throw-literal | ||
'no-throw-literal': 'error', | ||
@@ -305,2 +344,3 @@ | ||
// disallow usage of expressions in statement position | ||
// https://eslint.org/docs/rules/no-unused-expressions | ||
'no-unused-expressions': ['error', { | ||
@@ -317,2 +357,3 @@ allowShortCircuit: false, | ||
// disallow unnecessary .call() and .apply() | ||
// https://eslint.org/docs/rules/no-useless-call | ||
'no-useless-call': 'off', | ||
@@ -341,5 +382,7 @@ | ||
// disallow usage of configurable warning terms in comments: e.g. todo | ||
// https://eslint.org/docs/rules/no-warning-comments | ||
'no-warning-comments': ['off', { terms: ['todo', 'fixme', 'xxx'], location: 'start' }], | ||
// disallow use of the with statement | ||
// https://eslint.org/docs/rules/no-with | ||
'no-with': 'error', | ||
@@ -356,6 +399,8 @@ | ||
// https://eslint.org/docs/rules/prefer-regex-literals | ||
// TODO; enable, semver-minor, once eslint v6.4 is required (which is a major) | ||
'prefer-regex-literals': 'off', | ||
'prefer-regex-literals': ['error', { | ||
disallowRedundantWrapping: true, | ||
}], | ||
// require use of the second argument for parseInt() | ||
// https://eslint.org/docs/rules/radix | ||
radix: 'error', | ||
@@ -372,2 +417,3 @@ | ||
// requires to declare all vars on top of their containing scope | ||
// https://eslint.org/docs/rules/vars-on-top | ||
'vars-on-top': 'error', | ||
@@ -380,4 +426,5 @@ | ||
// require or disallow Yoda conditions | ||
// https://eslint.org/docs/rules/yoda | ||
yoda: 'error' | ||
} | ||
}; |
@@ -43,4 +43,3 @@ module.exports = { | ||
// https://eslint.org/docs/rules/no-dupe-else-if | ||
// TODO: enable, semver-major | ||
'no-dupe-else-if': 'off', | ||
'no-dupe-else-if': 'error', | ||
@@ -83,4 +82,3 @@ // disallow duplicate keys when creating object literals | ||
// https://eslint.org/docs/rules/no-import-assign | ||
// TODO: enable, semver-minor, once eslint v6.4 is required (which is a major) | ||
'no-import-assign': 'off', | ||
'no-import-assign': 'error', | ||
@@ -98,4 +96,3 @@ // disallow function or variable declarations in nested blocks | ||
// https://eslint.org/docs/rules/no-loss-of-precision | ||
// TODO: enable, semver-minor, once eslint v7.1 is required (which is major) | ||
'no-loss-of-precision': 'off', | ||
'no-loss-of-precision': 'error', | ||
@@ -111,4 +108,3 @@ // Disallow characters which are made with multiple code points in character class syntax | ||
// https://eslint.org/docs/rules/no-promise-executor-return | ||
// TODO: enable, semver-minor, once eslint v7.3 is required (which is major) | ||
'no-promise-executor-return': 'off', | ||
'no-promise-executor-return': 'error', | ||
@@ -124,4 +120,3 @@ // disallow use of Object.prototypes builtins directly | ||
// https://eslint.org/docs/rules/no-setter-return | ||
// TODO: enable, semver-major (altho the guide forbids getters/setters already) | ||
'no-setter-return': 'off', | ||
'no-setter-return': 'error', | ||
@@ -144,4 +139,3 @@ // disallow sparse arrays | ||
// https://eslint.org/docs/rules/no-unreachable-loop | ||
// TODO: enable, semver-minor, once eslint v7.3 is required (which is major) | ||
'no-unreachable-loop': ['off', { | ||
'no-unreachable-loop': ['error', { | ||
ignore: [], // WhileStatement, DoWhileStatement, ForStatement, ForInStatement, ForOfStatement | ||
@@ -158,6 +152,14 @@ }], | ||
// disallow use of optional chaining in contexts where the undefined value is not allowed | ||
// https://eslint.org/docs/rules/no-unsafe-optional-chaining | ||
'no-unsafe-optional-chaining': ['error', { disallowArithmeticOperators: true }], | ||
// Disallow Unused Private Class Members | ||
// https://eslint.org/docs/rules/no-unused-private-class-members | ||
// TODO: enable once eslint 7 is dropped (which is semver-major) | ||
'no-unused-private-class-members': 'off', | ||
// Disallow useless backreferences in regular expressions | ||
// https://eslint.org/docs/rules/no-useless-backreference | ||
// TODO: enable, semver-minor, once eslint v7 is required (which is major) | ||
'no-useless-backreference': 'off', | ||
'no-useless-backreference': 'error', | ||
@@ -164,0 +166,0 @@ // disallow negation of the left operand of an in expression |
@@ -65,7 +65,6 @@ module.exports = { | ||
// https://eslint.org/docs/rules/no-restricted-exports | ||
// TODO enable, semver-minor, once eslint v7 is required (which is major) | ||
'no-restricted-exports': ['off', { | ||
'no-restricted-exports': ['error', { | ||
restrictedNamedExports: [ | ||
'default', // use `export default` to provide a default export | ||
'then', // this will cause tons of confusion when your module is dynamically `import()`ed | ||
'then', // this will cause tons of confusion when your module is dynamically `import()`ed, and will break in most node ESM versions | ||
], | ||
@@ -150,3 +149,3 @@ }], | ||
// suggest using the spread operator instead of .apply() | ||
// suggest using the spread syntax instead of .apply() | ||
// https://eslint.org/docs/rules/prefer-spread | ||
@@ -153,0 +152,0 @@ 'prefer-spread': 'error', |
@@ -93,3 +93,4 @@ module.exports = { | ||
'**/protractor.conf.*.js', // protractor config | ||
'**/karma.conf.js' // karma config | ||
'**/karma.conf.js', // karma config | ||
'**/.eslintrc.js' // eslint config | ||
], | ||
@@ -256,3 +257,3 @@ optionalDependencies: false, | ||
// https://github.com/benmosher/eslint-plugin-import/blob/f63dd261809de6883b13b6b5b960e6d7f42a7813/docs/rules/no-unused-modules.md | ||
// TODO: enable, semver-major | ||
// TODO: enable once it supports CJS | ||
'import/no-unused-modules': ['off', { | ||
@@ -263,3 +264,13 @@ ignoreExports: [], | ||
}], | ||
// Reports the use of import declarations with CommonJS exports in any module except for the main module. | ||
// https://github.com/benmosher/eslint-plugin-import/blob/1012eb951767279ce3b540a4ec4f29236104bb5b/docs/rules/no-import-module-exports.md | ||
'import/no-import-module-exports': ['error', { | ||
exceptions: [], | ||
}], | ||
// Use this rule to prevent importing packages through relative paths. | ||
// https://github.com/benmosher/eslint-plugin-import/blob/1012eb951767279ce3b540a4ec4f29236104bb5b/docs/rules/no-relative-packages.md | ||
'import/no-relative-packages': 'error', | ||
}, | ||
}; |
@@ -0,1 +1,4 @@ | ||
const semver = require('semver'); | ||
const eslintPkg = require('eslint/package.json'); | ||
module.exports = { | ||
@@ -80,4 +83,3 @@ rules: { | ||
// https://eslint.org/docs/rules/function-call-argument-newline | ||
// TODO: enable, semver-minor, once eslint v6.2 is required (which is a major) | ||
'function-call-argument-newline': ['off', 'consistent'], | ||
'function-call-argument-newline': ['error', 'consistent'], | ||
@@ -105,11 +107,6 @@ // enforce spacing between functions and their invocations | ||
// enforce consistent line breaks inside function parentheses | ||
// require line breaks inside function parentheses if there are line breaks between parameters | ||
// https://eslint.org/docs/rules/function-paren-newline | ||
'function-paren-newline': ['error', 'consistent'], | ||
'function-paren-newline': ['error', semver.satisfies(eslintPkg.version, '>= 6') ? 'multiline-arguments' : 'consistent'], | ||
// Blacklist certain identifiers to prevent them being used | ||
// https://eslint.org/docs/rules/id-blacklist | ||
// TODO: semver-major, remove once eslint v7.4+ is required | ||
'id-blacklist': 'off', | ||
// disallow specified identifiers | ||
@@ -298,3 +295,3 @@ // https://eslint.org/docs/rules/id-denylist | ||
'no-mixed-operators': ['error', { | ||
// the list of arthmetic groups disallows mixing `%` and `**` | ||
// the list of arithmetic groups disallows mixing `%` and `**` | ||
// with other arithmetic operators. | ||
@@ -447,4 +444,3 @@ groups: [ | ||
// https://eslint.org/docs/rules/prefer-exponentiation-operator | ||
// TODO: enable, semver-major when eslint 5 is dropped | ||
'prefer-exponentiation-operator': 'off', | ||
'prefer-exponentiation-operator': 'error', | ||
@@ -451,0 +447,0 @@ // Prefer use of an object spread over Object.assign |
@@ -1,91 +0,102 @@ | ||
const assign = require('object.assign'); | ||
const entries = require('object.entries'); | ||
/* eslint global-require: 0 */ | ||
const { CLIEngine } = require('eslint'); | ||
const baseConfig = require('.'); | ||
if (CLIEngine) { | ||
/* eslint no-inner-declarations: 0 */ | ||
const assign = require('object.assign'); | ||
const entries = require('object.entries'); | ||
const severities = ['off', 'warn', 'error']; | ||
const baseConfig = require('.'); | ||
function getSeverity(ruleConfig) { | ||
if (Array.isArray(ruleConfig)) { | ||
return getSeverity(ruleConfig[0]); | ||
const severities = ['off', 'warn', 'error']; | ||
function getSeverity(ruleConfig) { | ||
if (Array.isArray(ruleConfig)) { | ||
return getSeverity(ruleConfig[0]); | ||
} | ||
if (typeof ruleConfig === 'number') { | ||
return severities[ruleConfig]; | ||
} | ||
return ruleConfig; | ||
} | ||
if (typeof ruleConfig === 'number') { | ||
return severities[ruleConfig]; | ||
} | ||
return ruleConfig; | ||
} | ||
function onlyErrorOnRules(rulesToError, config) { | ||
const errorsOnly = assign({}, config); | ||
const cli = new CLIEngine({ baseConfig: config, useEslintrc: false }); | ||
const baseRules = cli.getConfigForFile(require.resolve('./')).rules; | ||
function onlyErrorOnRules(rulesToError, config) { | ||
const errorsOnly = assign({}, config); | ||
const cli = new CLIEngine({ baseConfig: config, useEslintrc: false }); | ||
const baseRules = cli.getConfigForFile(require.resolve('./')).rules; | ||
entries(baseRules).forEach((rule) => { | ||
const ruleName = rule[0]; | ||
const ruleConfig = rule[1]; | ||
const severity = getSeverity(ruleConfig); | ||
entries(baseRules).forEach((rule) => { | ||
const ruleName = rule[0]; | ||
const ruleConfig = rule[1]; | ||
const severity = getSeverity(ruleConfig); | ||
if (rulesToError.indexOf(ruleName) === -1 && severity === 'error') { | ||
if (Array.isArray(ruleConfig)) { | ||
errorsOnly.rules[ruleName] = ['warn'].concat(ruleConfig.slice(1)); | ||
} else if (typeof ruleConfig === 'number') { | ||
errorsOnly.rules[ruleName] = 1; | ||
} else { | ||
errorsOnly.rules[ruleName] = 'warn'; | ||
if (rulesToError.indexOf(ruleName) === -1 && severity === 'error') { | ||
if (Array.isArray(ruleConfig)) { | ||
errorsOnly.rules[ruleName] = ['warn'].concat(ruleConfig.slice(1)); | ||
} else if (typeof ruleConfig === 'number') { | ||
errorsOnly.rules[ruleName] = 1; | ||
} else { | ||
errorsOnly.rules[ruleName] = 'warn'; | ||
} | ||
} | ||
} | ||
}); | ||
}); | ||
return errorsOnly; | ||
return errorsOnly; | ||
} | ||
module.exports = onlyErrorOnRules([ | ||
'array-bracket-newline', | ||
'array-bracket-spacing', | ||
'array-element-newline', | ||
'arrow-spacing', | ||
'block-spacing', | ||
'comma-spacing', | ||
'computed-property-spacing', | ||
'dot-location', | ||
'eol-last', | ||
'func-call-spacing', | ||
'function-paren-newline', | ||
'generator-star-spacing', | ||
'implicit-arrow-linebreak', | ||
'indent', | ||
'key-spacing', | ||
'keyword-spacing', | ||
'line-comment-position', | ||
'linebreak-style', | ||
'multiline-ternary', | ||
'newline-per-chained-call', | ||
'no-irregular-whitespace', | ||
'no-mixed-spaces-and-tabs', | ||
'no-multi-spaces', | ||
'no-regex-spaces', | ||
'no-spaced-func', | ||
'no-trailing-spaces', | ||
'no-whitespace-before-property', | ||
'nonblock-statement-body-position', | ||
'object-curly-newline', | ||
'object-curly-spacing', | ||
'object-property-newline', | ||
'one-var-declaration-per-line', | ||
'operator-linebreak', | ||
'padded-blocks', | ||
'padding-line-between-statements', | ||
'rest-spread-spacing', | ||
'semi-spacing', | ||
'semi-style', | ||
'space-before-blocks', | ||
'space-before-function-paren', | ||
'space-in-parens', | ||
'space-infix-ops', | ||
'space-unary-ops', | ||
'spaced-comment', | ||
'switch-colon-spacing', | ||
'template-tag-spacing', | ||
'import/newline-after-import', | ||
], baseConfig); | ||
} else { | ||
const path = require('path'); | ||
const { execSync } = require('child_process'); | ||
module.exports = JSON.parse(String(execSync(path.join(__dirname, 'whitespace-async.js')))); | ||
} | ||
module.exports = onlyErrorOnRules([ | ||
'array-bracket-newline', | ||
'array-bracket-spacing', | ||
'array-element-newline', | ||
'arrow-spacing', | ||
'block-spacing', | ||
'comma-spacing', | ||
'computed-property-spacing', | ||
'dot-location', | ||
'eol-last', | ||
'func-call-spacing', | ||
'function-paren-newline', | ||
'generator-star-spacing', | ||
'implicit-arrow-linebreak', | ||
'indent', | ||
'key-spacing', | ||
'keyword-spacing', | ||
'line-comment-position', | ||
'linebreak-style', | ||
'multiline-ternary', | ||
'newline-per-chained-call', | ||
'no-irregular-whitespace', | ||
'no-mixed-spaces-and-tabs', | ||
'no-multi-spaces', | ||
'no-regex-spaces', | ||
'no-spaced-func', | ||
'no-trailing-spaces', | ||
'no-whitespace-before-property', | ||
'nonblock-statement-body-position', | ||
'object-curly-newline', | ||
'object-curly-spacing', | ||
'object-property-newline', | ||
'one-var-declaration-per-line', | ||
'operator-linebreak', | ||
'padded-blocks', | ||
'padding-line-between-statements', | ||
'rest-spread-spacing', | ||
'semi-spacing', | ||
'semi-style', | ||
'space-before-blocks', | ||
'space-before-function-paren', | ||
'space-in-parens', | ||
'space-infix-ops', | ||
'space-unary-ops', | ||
'spaced-comment', | ||
'switch-colon-spacing', | ||
'template-tag-spacing', | ||
'import/newline-after-import', | ||
], baseConfig); |
Sorry, the diff of this file is not supported yet
Shell access
Supply chain riskThis module accesses the system shell. Accessing the system shell increases the risk of executing arbitrary code.
Found 1 instance in 1 package
94028
21
1615
113
6
1
+ Addedsemver@^6.3.0
+ Added@eslint-community/eslint-utils@4.4.0(transitive)
+ Added@eslint-community/regexpp@4.10.0(transitive)
+ Added@eslint/eslintrc@2.1.4(transitive)
+ Added@eslint/js@8.57.0(transitive)
+ Added@humanwhocodes/config-array@0.11.14(transitive)
+ Added@humanwhocodes/module-importer@1.0.1(transitive)
+ Added@humanwhocodes/object-schema@2.0.3(transitive)
+ Added@nodelib/fs.scandir@2.1.5(transitive)
+ Added@nodelib/fs.stat@2.0.5(transitive)
+ Added@nodelib/fs.walk@1.2.8(transitive)
+ Added@ungap/structured-clone@1.2.0(transitive)
+ Addedacorn@8.11.3(transitive)
+ Addedargparse@2.0.1(transitive)
+ Addedeslint@8.57.0(transitive)
+ Addedeslint-scope@7.2.2(transitive)
+ Addedeslint-visitor-keys@3.4.3(transitive)
+ Addedespree@9.6.1(transitive)
+ Addedfastq@1.17.1(transitive)
+ Addedfind-up@5.0.0(transitive)
+ Addedglob-parent@6.0.2(transitive)
+ Addedgraphemer@1.4.0(transitive)
+ Addedignore@5.3.1(transitive)
+ Addedis-path-inside@3.0.3(transitive)
+ Addedjs-yaml@4.1.0(transitive)
+ Addedlocate-path@6.0.0(transitive)
+ Addedp-limit@3.1.0(transitive)
+ Addedp-locate@5.0.0(transitive)
+ Addedpath-exists@4.0.0(transitive)
+ Addedqueue-microtask@1.2.3(transitive)
+ Addedreusify@1.0.4(transitive)
+ Addedrun-parallel@1.2.0(transitive)
+ Addedyocto-queue@0.1.0(transitive)
- Removed@babel/code-frame@7.12.11(transitive)
- Removed@babel/helper-validator-identifier@7.24.5(transitive)
- Removed@babel/highlight@7.24.5(transitive)
- Removed@eslint/eslintrc@0.4.3(transitive)
- Removed@humanwhocodes/config-array@0.5.0(transitive)
- Removed@humanwhocodes/object-schema@1.2.1(transitive)
- Removedacorn@7.4.1(transitive)
- Removedajv@8.13.0(transitive)
- Removedansi-colors@4.1.3(transitive)
- Removedansi-styles@3.2.1(transitive)
- Removedargparse@1.0.10(transitive)
- Removedastral-regex@2.0.0(transitive)
- Removedchalk@2.4.2(transitive)
- Removedcolor-convert@1.9.3(transitive)
- Removedcolor-name@1.1.3(transitive)
- Removedemoji-regex@8.0.0(transitive)
- Removedenquirer@2.4.1(transitive)
- Removedescape-string-regexp@1.0.5(transitive)
- Removedeslint@7.32.0(transitive)
- Removedeslint-scope@5.1.1(transitive)
- Removedeslint-utils@2.1.0(transitive)
- Removedeslint-visitor-keys@1.3.02.1.0(transitive)
- Removedespree@7.3.1(transitive)
- Removedesprima@4.0.1(transitive)
- Removedestraverse@4.3.0(transitive)
- Removedfunctional-red-black-tree@1.0.1(transitive)
- Removedglob-parent@5.1.2(transitive)
- Removedhas-flag@3.0.0(transitive)
- Removedignore@4.0.6(transitive)
- Removedis-fullwidth-code-point@3.0.0(transitive)
- Removedjs-tokens@4.0.0(transitive)
- Removedjs-yaml@3.14.1(transitive)
- Removedjson-schema-traverse@1.0.0(transitive)
- Removedlodash.truncate@4.4.2(transitive)
- Removedpicocolors@1.0.1(transitive)
- Removedprogress@2.0.3(transitive)
- Removedregexpp@3.2.0(transitive)
- Removedrequire-from-string@2.0.2(transitive)
- Removedsemver@7.6.2(transitive)
- Removedslice-ansi@4.0.0(transitive)
- Removedsprintf-js@1.0.3(transitive)
- Removedstring-width@4.2.3(transitive)
- Removedsupports-color@5.5.0(transitive)
- Removedtable@6.8.2(transitive)
- Removedv8-compile-cache@2.4.0(transitive)
Updatedobject.entries@^1.1.5