[lint] Allow lint warnings to pass in CI (#66140)
To allow us to incrementally adopt more comprehensive linting rules, this pull request disables the previous behaviour of failing CI when any warnings were discovered. Instead, this modifies the previous warnings to be errors which will preserve the previous linting behaviour. As we enable new lint rules, they can be added as warnings which will gently nudge us towards fixing in related pull requests.
This commit is contained in:
parent
16caf41995
commit
996a290afd
5 changed files with 98 additions and 96 deletions
182
.eslintrc.json
182
.eslintrc.json
|
@ -93,7 +93,7 @@
|
||||||
],
|
],
|
||||||
"no-unused-vars": "off",
|
"no-unused-vars": "off",
|
||||||
"@typescript-eslint/no-unused-vars": [
|
"@typescript-eslint/no-unused-vars": [
|
||||||
"warn",
|
"error",
|
||||||
{
|
{
|
||||||
"args": "none",
|
"args": "none",
|
||||||
"ignoreRestSiblings": true
|
"ignoreRestSiblings": true
|
||||||
|
@ -102,7 +102,7 @@
|
||||||
"no-use-before-define": "off",
|
"no-use-before-define": "off",
|
||||||
"no-useless-constructor": "off",
|
"no-useless-constructor": "off",
|
||||||
"@typescript-eslint/no-use-before-define": "off",
|
"@typescript-eslint/no-use-before-define": "off",
|
||||||
"@typescript-eslint/no-useless-constructor": "warn",
|
"@typescript-eslint/no-useless-constructor": "error",
|
||||||
"@typescript-eslint/prefer-literal-enum-member": "error"
|
"@typescript-eslint/prefer-literal-enum-member": "error"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -150,7 +150,7 @@
|
||||||
"packages/next/webpack.config.js"
|
"packages/next/webpack.config.js"
|
||||||
],
|
],
|
||||||
"rules": {
|
"rules": {
|
||||||
"no-shadow": ["warn", { "builtinGlobals": false }],
|
"no-shadow": ["error", { "builtinGlobals": false }],
|
||||||
"import/no-extraneous-dependencies": [
|
"import/no-extraneous-dependencies": [
|
||||||
"error",
|
"error",
|
||||||
{ "devDependencies": false }
|
{ "devDependencies": false }
|
||||||
|
@ -162,9 +162,9 @@
|
||||||
"rules": {
|
"rules": {
|
||||||
// Note: you must disable the base rule as it can report incorrect errors
|
// Note: you must disable the base rule as it can report incorrect errors
|
||||||
"no-shadow": "off",
|
"no-shadow": "off",
|
||||||
"@typescript-eslint/no-shadow": ["warn", { "builtinGlobals": false }],
|
"@typescript-eslint/no-shadow": ["error", { "builtinGlobals": false }],
|
||||||
"@typescript-eslint/no-unused-vars": [
|
"@typescript-eslint/no-unused-vars": [
|
||||||
"warn",
|
"error",
|
||||||
{
|
{
|
||||||
"args": "all",
|
"args": "all",
|
||||||
"argsIgnorePattern": "^_",
|
"argsIgnorePattern": "^_",
|
||||||
|
@ -211,39 +211,39 @@
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"rules": {
|
"rules": {
|
||||||
"array-callback-return": "warn",
|
"array-callback-return": "error",
|
||||||
"default-case": ["warn", { "commentPattern": "^no default$" }],
|
"default-case": ["error", { "commentPattern": "^no default$" }],
|
||||||
"dot-location": ["warn", "property"],
|
"dot-location": ["error", "property"],
|
||||||
"eqeqeq": ["warn", "smart"],
|
"eqeqeq": ["error", "smart"],
|
||||||
"new-parens": "warn",
|
"new-parens": "error",
|
||||||
"no-array-constructor": "warn",
|
"no-array-constructor": "error",
|
||||||
"no-caller": "warn",
|
"no-caller": "error",
|
||||||
"no-cond-assign": ["warn", "except-parens"],
|
"no-cond-assign": ["error", "except-parens"],
|
||||||
"no-const-assign": "warn",
|
"no-const-assign": "error",
|
||||||
"no-control-regex": "warn",
|
"no-control-regex": "error",
|
||||||
"no-delete-var": "warn",
|
"no-delete-var": "error",
|
||||||
"no-dupe-args": "warn",
|
"no-dupe-args": "error",
|
||||||
"no-dupe-class-members": "warn",
|
"no-dupe-class-members": "error",
|
||||||
"no-dupe-keys": "warn",
|
"no-dupe-keys": "error",
|
||||||
"no-duplicate-case": "warn",
|
"no-duplicate-case": "error",
|
||||||
"no-empty-character-class": "warn",
|
"no-empty-character-class": "error",
|
||||||
"no-empty-pattern": "warn",
|
"no-empty-pattern": "error",
|
||||||
"no-eval": "warn",
|
"no-eval": "error",
|
||||||
"no-ex-assign": "warn",
|
"no-ex-assign": "error",
|
||||||
"no-extend-native": "warn",
|
"no-extend-native": "error",
|
||||||
"no-extra-bind": "warn",
|
"no-extra-bind": "error",
|
||||||
"no-extra-label": "warn",
|
"no-extra-label": "error",
|
||||||
"no-fallthrough": "warn",
|
"no-fallthrough": "error",
|
||||||
"no-func-assign": "warn",
|
"no-func-assign": "error",
|
||||||
"no-implied-eval": "warn",
|
"no-implied-eval": "error",
|
||||||
"no-invalid-regexp": "warn",
|
"no-invalid-regexp": "error",
|
||||||
"no-iterator": "warn",
|
"no-iterator": "error",
|
||||||
"no-label-var": "warn",
|
"no-label-var": "error",
|
||||||
"no-labels": ["warn", { "allowLoop": true, "allowSwitch": false }],
|
"no-labels": ["error", { "allowLoop": true, "allowSwitch": false }],
|
||||||
"no-lone-blocks": "warn",
|
"no-lone-blocks": "error",
|
||||||
"no-loop-func": "warn",
|
"no-loop-func": "error",
|
||||||
"no-mixed-operators": [
|
"no-mixed-operators": [
|
||||||
"warn",
|
"error",
|
||||||
{
|
{
|
||||||
"groups": [
|
"groups": [
|
||||||
["&", "|", "^", "~", "<<", ">>", ">>>"],
|
["&", "|", "^", "~", "<<", ">>", ">>>"],
|
||||||
|
@ -254,37 +254,37 @@
|
||||||
"allowSamePrecedence": false
|
"allowSamePrecedence": false
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"no-multi-str": "warn",
|
"no-multi-str": "error",
|
||||||
"no-native-reassign": "warn",
|
"no-native-reassign": "error",
|
||||||
"no-negated-in-lhs": "warn",
|
"no-negated-in-lhs": "error",
|
||||||
"no-new-func": "warn",
|
"no-new-func": "error",
|
||||||
"no-new-object": "warn",
|
"no-new-object": "error",
|
||||||
"no-new-symbol": "warn",
|
"no-new-symbol": "error",
|
||||||
"no-new-wrappers": "warn",
|
"no-new-wrappers": "error",
|
||||||
"no-obj-calls": "warn",
|
"no-obj-calls": "error",
|
||||||
"no-octal": "warn",
|
"no-octal": "error",
|
||||||
"no-octal-escape": "warn",
|
"no-octal-escape": "error",
|
||||||
"no-regex-spaces": "warn",
|
"no-regex-spaces": "error",
|
||||||
"no-restricted-syntax": [
|
"no-restricted-syntax": [
|
||||||
"warn",
|
"error",
|
||||||
"WithStatement",
|
"WithStatement",
|
||||||
{
|
{
|
||||||
"message": "substr() is deprecated, use slice() or substring() instead",
|
"message": "substr() is deprecated, use slice() or substring() instead",
|
||||||
"selector": "MemberExpression > Identifier[name='substr']"
|
"selector": "MemberExpression > Identifier[name='substr']"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"no-script-url": "warn",
|
"no-script-url": "error",
|
||||||
"no-self-assign": "warn",
|
"no-self-assign": "error",
|
||||||
"no-self-compare": "warn",
|
"no-self-compare": "error",
|
||||||
"no-sequences": "warn",
|
"no-sequences": "error",
|
||||||
"no-shadow-restricted-names": "warn",
|
"no-shadow-restricted-names": "error",
|
||||||
"no-sparse-arrays": "warn",
|
"no-sparse-arrays": "error",
|
||||||
"no-template-curly-in-string": "error",
|
"no-template-curly-in-string": "error",
|
||||||
"no-this-before-super": "warn",
|
"no-this-before-super": "error",
|
||||||
"no-throw-literal": "warn",
|
"no-throw-literal": "error",
|
||||||
"no-undef": "error",
|
"no-undef": "error",
|
||||||
"no-unexpected-multiline": "warn",
|
"no-unexpected-multiline": "error",
|
||||||
"no-unreachable": "warn",
|
"no-unreachable": "error",
|
||||||
"no-unused-expressions": [
|
"no-unused-expressions": [
|
||||||
"error",
|
"error",
|
||||||
{
|
{
|
||||||
|
@ -293,64 +293,64 @@
|
||||||
"allowTaggedTemplates": true
|
"allowTaggedTemplates": true
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"no-unused-labels": "warn",
|
"no-unused-labels": "error",
|
||||||
"no-unused-vars": [
|
"no-unused-vars": [
|
||||||
"warn",
|
"error",
|
||||||
{
|
{
|
||||||
"args": "none",
|
"args": "none",
|
||||||
"ignoreRestSiblings": true
|
"ignoreRestSiblings": true
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"no-use-before-define": "off",
|
"no-use-before-define": "off",
|
||||||
"no-useless-computed-key": "warn",
|
"no-useless-computed-key": "error",
|
||||||
"no-useless-concat": "warn",
|
"no-useless-concat": "error",
|
||||||
"no-useless-constructor": "warn",
|
"no-useless-constructor": "error",
|
||||||
"no-useless-escape": "warn",
|
"no-useless-escape": "error",
|
||||||
"no-useless-rename": [
|
"no-useless-rename": [
|
||||||
"warn",
|
"error",
|
||||||
{
|
{
|
||||||
"ignoreDestructuring": false,
|
"ignoreDestructuring": false,
|
||||||
"ignoreImport": false,
|
"ignoreImport": false,
|
||||||
"ignoreExport": false
|
"ignoreExport": false
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"no-with": "warn",
|
"no-with": "error",
|
||||||
"no-whitespace-before-property": "warn",
|
"no-whitespace-before-property": "error",
|
||||||
"react-hooks/exhaustive-deps": "warn",
|
"react-hooks/exhaustive-deps": "error",
|
||||||
"require-yield": "warn",
|
"require-yield": "error",
|
||||||
"rest-spread-spacing": ["warn", "never"],
|
"rest-spread-spacing": ["error", "never"],
|
||||||
"strict": ["warn", "never"],
|
"strict": ["error", "never"],
|
||||||
"unicode-bom": ["warn", "never"],
|
"unicode-bom": ["error", "never"],
|
||||||
"use-isnan": "warn",
|
"use-isnan": "error",
|
||||||
"valid-typeof": "warn",
|
"valid-typeof": "error",
|
||||||
"getter-return": "warn",
|
"getter-return": "error",
|
||||||
"react/forbid-foreign-prop-types": ["warn", { "allowInPropTypes": true }],
|
"react/forbid-foreign-prop-types": ["error", { "allowInPropTypes": true }],
|
||||||
"react/jsx-no-comment-textnodes": "warn",
|
"react/jsx-no-comment-textnodes": "error",
|
||||||
"react/jsx-no-duplicate-props": "warn",
|
"react/jsx-no-duplicate-props": "error",
|
||||||
"react/jsx-no-target-blank": "warn",
|
"react/jsx-no-target-blank": "error",
|
||||||
"react/jsx-no-undef": "error",
|
"react/jsx-no-undef": "error",
|
||||||
"react/jsx-pascal-case": [
|
"react/jsx-pascal-case": [
|
||||||
"warn",
|
"error",
|
||||||
{
|
{
|
||||||
"allowAllCaps": true,
|
"allowAllCaps": true,
|
||||||
"ignore": []
|
"ignore": []
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"react/jsx-uses-react": "warn",
|
"react/jsx-uses-react": "error",
|
||||||
"react/jsx-uses-vars": "warn",
|
"react/jsx-uses-vars": "error",
|
||||||
"react/no-danger-with-children": "warn",
|
"react/no-danger-with-children": "error",
|
||||||
"react/no-deprecated": "warn",
|
"react/no-deprecated": "error",
|
||||||
"react/no-direct-mutation-state": "warn",
|
"react/no-direct-mutation-state": "error",
|
||||||
"react/no-is-mounted": "warn",
|
"react/no-is-mounted": "error",
|
||||||
"react/no-typos": "error",
|
"react/no-typos": "error",
|
||||||
"react/react-in-jsx-scope": "off",
|
"react/react-in-jsx-scope": "off",
|
||||||
"react/require-render-return": "error",
|
"react/require-render-return": "error",
|
||||||
"react/style-prop-object": "warn",
|
"react/style-prop-object": "error",
|
||||||
"react-hooks/rules-of-hooks": "error",
|
"react-hooks/rules-of-hooks": "error",
|
||||||
// "@typescript-eslint/non-nullable-type-assertion-style": "warn",
|
// "@typescript-eslint/non-nullable-type-assertion-style": "error",
|
||||||
"@typescript-eslint/prefer-as-const": "warn",
|
"@typescript-eslint/prefer-as-const": "error",
|
||||||
"@typescript-eslint/no-redeclare": [
|
"@typescript-eslint/no-redeclare": [
|
||||||
"warn",
|
"error",
|
||||||
{ "builtinGlobals": false, "ignoreDeclarationMerge": true }
|
{ "builtinGlobals": false, "ignoreDeclarationMerge": true }
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,7 +30,7 @@ module.exports = {
|
||||||
|
|
||||||
return [
|
return [
|
||||||
`prettier --with-node-modules --ignore-path .prettierignore --write ${escapedFileNames}`,
|
`prettier --with-node-modules --ignore-path .prettierignore --write ${escapedFileNames}`,
|
||||||
`eslint --no-ignore --max-warnings=0 --fix ${eslintFileNames
|
`eslint --no-ignore --fix ${eslintFileNames
|
||||||
.filter((filename) => filename !== null)
|
.filter((filename) => filename !== null)
|
||||||
.map((filename) => {
|
.map((filename) => {
|
||||||
return `"${filename}"`
|
return `"${filename}"`
|
||||||
|
|
|
@ -33,12 +33,12 @@
|
||||||
"git-clean": "git clean -d -x -e node_modules -e packages -f",
|
"git-clean": "git clean -d -x -e node_modules -e packages -f",
|
||||||
"typescript": "tsc --noEmit",
|
"typescript": "tsc --noEmit",
|
||||||
"lint-typescript": "turbo run typescript",
|
"lint-typescript": "turbo run typescript",
|
||||||
"lint-eslint": "eslint . --ext js,jsx,ts,tsx --max-warnings=0 --config .eslintrc.json --no-eslintrc",
|
"lint-eslint": "eslint . --ext js,jsx,ts,tsx --config .eslintrc.json --no-eslintrc",
|
||||||
"lint-no-typescript": "run-p prettier-check lint-eslint lint-language",
|
"lint-no-typescript": "run-p prettier-check lint-eslint lint-language",
|
||||||
"types-and-precompiled": "run-p lint-typescript check-precompiled validate-externals-doc",
|
"types-and-precompiled": "run-p lint-typescript check-precompiled validate-externals-doc",
|
||||||
"validate-externals-doc": "node ./scripts/validate-externals-doc.js",
|
"validate-externals-doc": "node ./scripts/validate-externals-doc.js",
|
||||||
"lint": "run-p test-types lint-typescript prettier-check lint-eslint lint-language",
|
"lint": "run-p test-types lint-typescript prettier-check lint-eslint lint-language",
|
||||||
"lint-fix": "pnpm prettier-fix && eslint . --ext js,jsx,ts,tsx --fix --max-warnings=0 --config .eslintrc.json --no-eslintrc",
|
"lint-fix": "pnpm prettier-fix && eslint . --ext js,jsx,ts,tsx --fix --config .eslintrc.json --no-eslintrc",
|
||||||
"lint-language": "alex .",
|
"lint-language": "alex .",
|
||||||
"prettier-check": "prettier --check .",
|
"prettier-check": "prettier --check .",
|
||||||
"check-examples": "./scripts/check-examples.sh",
|
"check-examples": "./scripts/check-examples.sh",
|
||||||
|
|
|
@ -23,7 +23,7 @@
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "ncc build ./index.ts -w -o dist/",
|
"dev": "ncc build ./index.ts -w -o dist/",
|
||||||
"prerelease": "node ../../scripts/rm.mjs dist",
|
"prerelease": "node ../../scripts/rm.mjs dist",
|
||||||
"types": "tsc index.ts --declaration --emitDeclarationOnly --declarationDir dist --esModuleInterop",
|
"types": "tsc --declaration --emitDeclarationOnly --declarationDir dist",
|
||||||
"release": "ncc build ./index.ts -o ./dist/ --minify --no-cache --no-source-map-register",
|
"release": "ncc build ./index.ts -o ./dist/ --minify --no-cache --no-source-map-register",
|
||||||
"build": "pnpm release && pnpm types",
|
"build": "pnpm release && pnpm types",
|
||||||
"prepublishOnly": "cd ../../ && turbo run build"
|
"prepublishOnly": "cd ../../ && turbo run build"
|
||||||
|
|
|
@ -6,5 +6,7 @@
|
||||||
"resolveJsonModule": true,
|
"resolveJsonModule": true,
|
||||||
"esModuleInterop": true,
|
"esModuleInterop": true,
|
||||||
"skipLibCheck": false
|
"skipLibCheck": false
|
||||||
}
|
},
|
||||||
|
"include": ["**/*.ts"],
|
||||||
|
"exclude": ["node_modules", "dist"]
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue