Skip to content

Commit

Permalink
refactor!: Remove special syntax for a rules with error severity
Browse files Browse the repository at this point in the history
BREAKING CHANGE: As a part of the migration to ESLint 9 and making things more explicit, we decided to drop the special syntax from the configurations.
Some rules that previously had a severity of “warning” now have a severity of “error”.
Although most of them were fixed automatically, something unexpected can happen.
Autofix of such rules is still working.
  • Loading branch information
MorevM committed Jun 8, 2024
1 parent 150abfe commit f2d356b
Show file tree
Hide file tree
Showing 22 changed files with 107 additions and 105 deletions.
2 changes: 1 addition & 1 deletion configurations/astro/rules/astro.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ module.exports = {

// Disallow using deprecated `Astro.fetchContent()` (autofixable)
// https://ota-meshi.github.io/eslint-plugin-astro/rules/no-deprecated-astro-fetchcontent/
'+astro/no-deprecated-astro-fetchcontent': 'error',
'astro/no-deprecated-astro-fetchcontent': 'error',

// Disallow using deprecated `Astro.resolve()`
// https://ota-meshi.github.io/eslint-plugin-astro/rules/no-deprecated-astro-resolve/
Expand Down
12 changes: 6 additions & 6 deletions configurations/base/plugins/jsdoc.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,13 +47,13 @@ module.exports = {
// https://github.com/gajus/eslint-plugin-jsdoc#check-syntax
'jsdoc/check-syntax': 'error',

// Reports invalid block tag names (autofixable)
// Reports invalid block tag names
// https://github.com/gajus/eslint-plugin-jsdoc#check-tag-names
'+jsdoc/check-tag-names': 'error',
'jsdoc/check-tag-names': 'error',

// Reports invalid types (autofixable)
// Reports invalid types
// https://github.com/gajus/eslint-plugin-jsdoc#check-types
'+jsdoc/check-types': 'error',
'jsdoc/check-types': 'error',

// Reports invalid types
// https://github.com/gajus/eslint-plugin-jsdoc#check-values
Expand Down Expand Up @@ -96,7 +96,7 @@ module.exports = {
// Checks for multi-line-style comments which fail
// to meet the criteria of a jsdoc block (autofixable)
// https://github.com/gajus/eslint-plugin-jsdoc#no-bad-blocks
'+jsdoc/no-bad-blocks': ['error', {
'jsdoc/no-bad-blocks': ['error', {
ignore: ['ts-check', 'ts-expect-error', 'ts-ignore', 'ts-nocheck', 'vite-ignore'],
}],

Expand Down Expand Up @@ -183,7 +183,7 @@ module.exports = {
// Requires that all function parameters are documented (autofixable?)
// https://github.com/gajus/eslint-plugin-jsdoc#require-param
// Note: document all or nothing!
'+jsdoc/require-param': ['error', {
'jsdoc/require-param': ['error', {
enableFixer: true,
}],

Expand Down
42 changes: 21 additions & 21 deletions configurations/base/plugins/regexp.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,13 +63,13 @@ module.exports = {

// Disallow multi-code-point characters in character classes and quantifiers (autofixable)
// https://ota-meshi.github.io/eslint-plugin-regexp/rules/no-misleading-unicode-character.html
'+regexp/no-misleading-unicode-character': ['error', {
'regexp/no-misleading-unicode-character': ['error', {
fixable: true,
}],

// Disallow missing `g` flag in patterns used in `String#matchAll` and `String#replaceAll` (autofixable)
// https://ota-meshi.github.io/eslint-plugin-regexp/rules/no-missing-g-flag.html
'+regexp/no-missing-g-flag': ['error', {
'regexp/no-missing-g-flag': ['error', {
strictTypes: true,
}],

Expand Down Expand Up @@ -122,7 +122,7 @@ module.exports = {

// Enforce consistent escaping of control characters (autofixable)
// https://ota-meshi.github.io/eslint-plugin-regexp/rules/control-character-escape.html
'+regexp/control-character-escape': 'error',
'regexp/control-character-escape': 'error',

// Enforce use of escapes on negation (autofixable)
// https://ota-meshi.github.io/eslint-plugin-regexp/rules/negation.html
Expand All @@ -138,11 +138,11 @@ module.exports = {

// Disallow unnecessary nested lookaround assertions (autofixable)
// https://ota-meshi.github.io/eslint-plugin-regexp/rules/no-extra-lookaround-assertions.html
'+regexp/no-extra-lookaround-assertions': 'error',
'regexp/no-extra-lookaround-assertions': 'error',

// Disallow invisible raw character (autofixable)
// https://ota-meshi.github.io/eslint-plugin-regexp/rules/no-invisible-character.html
'+regexp/no-invisible-character': 'error',
'regexp/no-invisible-character': 'error',

// Disallow legacy RegExp features
// https://ota-meshi.github.io/eslint-plugin-regexp/rules/no-legacy-features.html
Expand Down Expand Up @@ -171,11 +171,11 @@ module.exports = {

// Disallow trivially nested assertions (autofixable)
// https://ota-meshi.github.io/eslint-plugin-regexp/rules/no-trivially-nested-assertion.html
'+regexp/no-trivially-nested-assertion': 'error',
'regexp/no-trivially-nested-assertion': 'error',

// Disallow nested quantifiers that can be rewritten as one quantifier (autofixable)
// https://ota-meshi.github.io/eslint-plugin-regexp/rules/no-trivially-nested-quantifier.html
'+regexp/no-trivially-nested-quantifier': 'error',
'regexp/no-trivially-nested-quantifier': 'error',

// Disallow unused capturing group (autofixable but may be confusing)
// https://ota-meshi.github.io/eslint-plugin-regexp/rules/no-unused-capturing-group.html
Expand All @@ -185,7 +185,7 @@ module.exports = {

// Disallow character class with one character (autofixable)
// https://ota-meshi.github.io/eslint-plugin-regexp/rules/no-useless-character-class.html
'+regexp/no-useless-character-class': 'error',
'regexp/no-useless-character-class': 'error',

// Disallow unnecessary regex flags (autofixable)
// https://ota-meshi.github.io/eslint-plugin-regexp/rules/no-useless-flag.html
Expand All @@ -196,15 +196,15 @@ module.exports = {

// Disallow unnecessarily non-greedy quantifiers (autofixable)
// https://ota-meshi.github.io/eslint-plugin-regexp/rules/no-useless-lazy.html
'+regexp/no-useless-lazy': 'error',
'regexp/no-useless-lazy': 'error',

// Disallow quantifiers that can be removed (autofixable)
// https://ota-meshi.github.io/eslint-plugin-regexp/rules/no-useless-quantifier.html
'+regexp/no-useless-quantifier': 'error',
'regexp/no-useless-quantifier': 'error',

// Disallow unnecessary range of characters by using a hyphen (autofixable)
// https://ota-meshi.github.io/eslint-plugin-regexp/rules/no-useless-range.html
'+regexp/no-useless-range': 'error',
'regexp/no-useless-range': 'error',

// Disallow unnecessary elements in expression character classes (autofixable)
// https://ota-meshi.github.io/eslint-plugin-regexp/rules/no-useless-set-operand.html
Expand All @@ -216,7 +216,7 @@ module.exports = {

// Disallow unnecessary `{n,m}` quantifier (autofixable)
// https://ota-meshi.github.io/eslint-plugin-regexp/rules/no-useless-two-nums-quantifier.html
'+regexp/no-useless-two-nums-quantifier': 'error',
'regexp/no-useless-two-nums-quantifier': 'error',

// Disallow quantifiers with a maximum of zero
// https://ota-meshi.github.io/eslint-plugin-regexp/rules/no-zero-quantifier.html
Expand All @@ -238,7 +238,7 @@ module.exports = {

// Prefer predefined assertion over equivalent lookarounds (autofixable)
// https://ota-meshi.github.io/eslint-plugin-regexp/rules/prefer-predefined-assertion.html
'+regexp/prefer-predefined-assertion': 'error',
'regexp/prefer-predefined-assertion': 'error',

// Enforce using quantifier (autofixable)
// https://ota-meshi.github.io/eslint-plugin-regexp/rules/prefer-quantifier.html
Expand Down Expand Up @@ -318,13 +318,13 @@ module.exports = {

// Disallow unnecessary non-capturing group (autofixable)
// https://ota-meshi.github.io/eslint-plugin-regexp/rules/no-useless-non-capturing-group.html
'+regexp/no-useless-non-capturing-group': ['error', {
'regexp/no-useless-non-capturing-group': ['error', {
allowTop: 'partial', // or "always" or "never"
}],

// Enforce using character class (autofixable)
// https://ota-meshi.github.io/eslint-plugin-regexp/rules/prefer-character-class.html
'+regexp/prefer-character-class': ['error', {
'regexp/prefer-character-class': ['error', {
minAlternatives: 2,
}],

Expand All @@ -341,7 +341,7 @@ module.exports = {

// Enforce using named backreferences (autofixable)
// https://ota-meshi.github.io/eslint-plugin-regexp/rules/prefer-named-backreference.html
'+regexp/prefer-named-backreference': 'error',
'regexp/prefer-named-backreference': 'error',

// Enforce using named capture groups
// https://ota-meshi.github.io/eslint-plugin-regexp/rules/prefer-named-capture-group.html
Expand All @@ -350,27 +350,27 @@ module.exports = {

// Enforce using named replacement (autofixable)
// https://ota-meshi.github.io/eslint-plugin-regexp/rules/prefer-named-replacement.html
'+regexp/prefer-named-replacement': ['error', {
'regexp/prefer-named-replacement': ['error', {
strictTypes: true,
}],

// Enforce using `+` quantifier (autofixable)
// https://ota-meshi.github.io/eslint-plugin-regexp/rules/prefer-plus-quantifier.html
'+regexp/prefer-plus-quantifier': 'error',
'regexp/prefer-plus-quantifier': 'error',

// Enforce using `?` quantifier (autofixable)
// https://ota-meshi.github.io/eslint-plugin-regexp/rules/prefer-question-quantifier.html
'+regexp/prefer-question-quantifier': 'error',
'regexp/prefer-question-quantifier': 'error',

// Enforce using result array groups (autofixable)
// https://ota-meshi.github.io/eslint-plugin-regexp/rules/prefer-result-array-groups.html
'+regexp/prefer-result-array-groups': ['error', {
'regexp/prefer-result-array-groups': ['error', {
strictTypes: true,
}],

// Enforce using `*` quantifier (autofixable)
// https://ota-meshi.github.io/eslint-plugin-regexp/rules/prefer-star-quantifier.html
'+regexp/prefer-star-quantifier': 'error',
'regexp/prefer-star-quantifier': 'error',

// Enforce use of unicode codepoint escapes (autofixable)
// https://ota-meshi.github.io/eslint-plugin-regexp/rules/prefer-unicode-codepoint-escapes.html
Expand Down
2 changes: 1 addition & 1 deletion configurations/base/plugins/sonarjs.js
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,6 @@ module.exports = {

// A "while" loop should be used instead of a "for" loop (autofixable)
// https://github.com/SonarSource/eslint-plugin-sonarjs/blob/master/docs/rules/prefer-while.md
'+sonarjs/prefer-while': 'error',
'sonarjs/prefer-while': 'error',
},
};
12 changes: 6 additions & 6 deletions configurations/base/plugins/stylistic.js
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ module.exports = {

// Enforce consistent linebreak style (autofixable)
// https://eslint.style/rules/js/linebreak-style
'+@stylistic/js/linebreak-style': ['error', 'unix'],
'@stylistic/js/linebreak-style': ['error', 'unix'],

// Enforce empty lines around comments (autofixable)
// https://eslint.style/rules/js/lines-around-comment
Expand Down Expand Up @@ -189,7 +189,7 @@ module.exports = {

// Disallow arrow functions where they could be confused with comparisons (autofixable)
// https://eslint.style/rules/js/no-confusing-arrow
'+@stylistic/js/no-confusing-arrow': ['error', {
'@stylistic/js/no-confusing-arrow': ['error', {
allowParens: true,
onlyOneSimpleParam: true,
}],
Expand Down Expand Up @@ -257,18 +257,18 @@ module.exports = {

// Disallow trailing whitespace at the end of lines (autofixable)
// https://eslint.style/rules/js/no-trailing-spaces
'+@stylistic/js/no-trailing-spaces': ['error', {
'@stylistic/js/no-trailing-spaces': ['error', {
skipBlankLines: false,
ignoreComments: false,
}],

// Disallow whitespace before properties (autofixable)
// https://eslint.style/rules/js/no-whitespace-before-property
'+@stylistic/js/no-whitespace-before-property': 'error',
'@stylistic/js/no-whitespace-before-property': 'error',

// Enforce the location of single-line statements (autofixable)
// https://eslint.style/rules/js/nonblock-statement-body-position
'+@stylistic/js/nonblock-statement-body-position': ['error', 'beside', {
'@stylistic/js/nonblock-statement-body-position': ['error', 'beside', {
overrides: {},
}],

Expand All @@ -293,7 +293,7 @@ module.exports = {

// Require or disallow newlines around variable declarations (autofixable)
// https://eslint.style/rules/js/one-var-declaration-per-line
'+@stylistic/js/one-var-declaration-per-line': ['error', 'always'],
'@stylistic/js/one-var-declaration-per-line': ['error', 'always'],

// Requires operator at the beginning of the line in multiline statements (autofixable)
// https://eslint.style/rules/js/operator-linebreak
Expand Down
26 changes: 13 additions & 13 deletions configurations/base/plugins/unicorn.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ module.exports = {

// Enforce correct `Error` subclassing (autofixable)
// https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/custom-error-definition.md
'+unicorn/custom-error-definition': 'error',
'unicorn/custom-error-definition': 'error',

// Enforce no spaces between braces (autofixable)
// https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/empty-brace-spaces.md
Expand Down Expand Up @@ -135,15 +135,15 @@ module.exports = {

// Require `Array.isArray()` instead of `instanceof Array` (autofixable)
// https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-instanceof-array.md
'+unicorn/no-instanceof-array': 'error',
'unicorn/no-instanceof-array': 'error',

// Disallow invalid options in `fetch()` and `new Request()`
// https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-invalid-fetch-options.md
'unicorn/no-invalid-fetch-options': 'error',

// Prevent calling `EventTarget#removeEventListener()` with the result of an expression.
// https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-invalid-remove-event-listener.md
'+unicorn/no-invalid-remove-event-listener': 'error',
'unicorn/no-invalid-remove-event-listener': 'error',

// Disallow identifiers starting with new or class
// https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-keyword-prefix.md
Expand Down Expand Up @@ -177,7 +177,7 @@ module.exports = {
// Enforce the use of `Buffer.from()` and `Buffer.alloc()` instead of the deprecated `new Buffer()`
// (partly autofixable)
// https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-new-buffer.md
'+unicorn/no-new-buffer': 'error',
'unicorn/no-new-buffer': 'error',

// Disallow the use of the `null` literal
// https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-null.md
Expand Down Expand Up @@ -252,7 +252,7 @@ module.exports = {

// Disallow useless spread (autofixable)
// https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-useless-spread.md
'+unicorn/no-useless-spread': 'error',
'unicorn/no-useless-spread': 'error',

// Disallow useless case in switch statements
// https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-useless-switch-case.md
Expand All @@ -275,7 +275,7 @@ module.exports = {
// Enforce the style of numeric separators by correctly grouping digits (autofixable)
// https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/numeric-separators-style.md
// Note: all default
'+unicorn/numeric-separators-style': ['error', {
'unicorn/numeric-separators-style': ['error', {
onlyIfContainsSeparator: true,
hexadecimal: {
minimumDigits: 0,
Expand Down Expand Up @@ -338,7 +338,7 @@ module.exports = {

// Prefer default parameters over reassignment (autofixable)
// https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-default-parameters.md
'+unicorn/prefer-default-parameters': 'error',
'unicorn/prefer-default-parameters': 'error',

// Prefer `export…from` when re-exporting (autofixable but might be confusing during development flow)
// https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-export-from.md
Expand All @@ -349,7 +349,7 @@ module.exports = {
// Prefer `.includes()` over `.indexOf()` and `Array#some()` when checking for existence or non-existence
// (partly autofixable)
// https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-includes.md
'+unicorn/prefer-includes': 'error',
'unicorn/prefer-includes': 'error',

// Prefer reading a JSON file as a buffer (autofixable)
// https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-json-parse-buffer.md
Expand Down Expand Up @@ -379,7 +379,7 @@ module.exports = {
// Prefer negative index over `.length - index` for `{String,Array,TypedArray}#slice()`,
// `Array#splice()` and `Array#at()` (autofixable)
// https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-negative-index.md
'+unicorn/prefer-negative-index': 'error',
'unicorn/prefer-negative-index': 'error',

// Prefer `Number` static properties over global ones (partly autofixable)
// https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-number-properties.md
Expand Down Expand Up @@ -426,7 +426,7 @@ module.exports = {

// Prefer the spread operator over `Array.from(…)`, `Array#concat(…)` and `Array#slice()` (partly autofixable)
// https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-spread.md
'+unicorn/prefer-spread': 'error',
'unicorn/prefer-spread': 'error',

// Prefer using the `String.raw` tag to avoid escaping `\` (autofixable but confusing)
// https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-string-raw.md
Expand All @@ -444,7 +444,7 @@ module.exports = {

// Prefer `String#startsWith()` && `String#endsWith()` over `RegExp#test()` (partly autofixable)
// https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-string-starts-ends-with.md
'+unicorn/prefer-string-starts-ends-with': 'error',
'unicorn/prefer-string-starts-ends-with': 'error',

// Prefer `String#trimStart()` / `String#trimEnd()` over `String#trimLeft()` / `String#trimRight()` (autofixable)
// https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-string-trim-start-end.md
Expand All @@ -464,7 +464,7 @@ module.exports = {

// Prefer ternary expressions over simple if-else statements (autofixable)
// https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-ternary.md
'+unicorn/prefer-ternary': ['error', 'only-single-line'],
'unicorn/prefer-ternary': ['error', 'only-single-line'],

// Prefer top-level await over top-level promises and async function calls
// https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-top-level-await.md
Expand Down Expand Up @@ -509,7 +509,7 @@ module.exports = {

// Enforce using the separator argument with `Array#join()` (autofixable)
// https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/require-array-join-separator.md
'+unicorn/require-array-join-separator': 'error',
'unicorn/require-array-join-separator': 'error',

// Enforce using the digits argument with `Number#toFixed()` (autofixable)
// https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/require-number-to-fixed-digits-argument.md
Expand Down
2 changes: 1 addition & 1 deletion configurations/base/rules/layout-and-formatting.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,6 @@ module.exports = {

// Require or disallow Unicode byte order mark (BOM) (autofixable)
// https://eslint.org/docs/rules/unicode-bom
'+unicode-bom': ['error', 'never'],
'unicode-bom': ['error', 'never'],
},
};
Loading

0 comments on commit f2d356b

Please sign in to comment.