From fc6fe787ad222961042f2585996f37b287967afb Mon Sep 17 00:00:00 2001 From: Wyatt Johnson Date: Thu, 23 May 2024 13:30:59 -0600 Subject: [PATCH] feat: allow lint warnings in CI --- .eslintrc.json | 182 ++++++++++----------- lint-staged.config.js | 2 +- package.json | 4 +- packages/font/tsconfig.json | 3 +- packages/next-codemod/tsconfig.json | 3 +- packages/next-env/package.json | 2 +- packages/next-env/tsconfig.json | 6 +- packages/next/tsconfig.json | 3 +- packages/react-refresh-utils/tsconfig.json | 1 + packages/third-parties/tsconfig.json | 3 +- 10 files changed, 108 insertions(+), 101 deletions(-) diff --git a/.eslintrc.json b/.eslintrc.json index 0081edc950129d..4151575356c857 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -93,7 +93,7 @@ ], "no-unused-vars": "off", "@typescript-eslint/no-unused-vars": [ - "warn", + "error", { "args": "none", "ignoreRestSiblings": true @@ -102,7 +102,7 @@ "no-use-before-define": "off", "no-useless-constructor": "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" } }, @@ -150,7 +150,7 @@ "packages/next/webpack.config.js" ], "rules": { - "no-shadow": ["warn", { "builtinGlobals": false }], + "no-shadow": ["error", { "builtinGlobals": false }], "import/no-extraneous-dependencies": [ "error", { "devDependencies": false } @@ -162,9 +162,9 @@ "rules": { // Note: you must disable the base rule as it can report incorrect errors "no-shadow": "off", - "@typescript-eslint/no-shadow": ["warn", { "builtinGlobals": false }], + "@typescript-eslint/no-shadow": ["error", { "builtinGlobals": false }], "@typescript-eslint/no-unused-vars": [ - "warn", + "error", { "args": "all", "argsIgnorePattern": "^_", @@ -211,39 +211,39 @@ } ], "rules": { - "array-callback-return": "warn", - "default-case": ["warn", { "commentPattern": "^no default$" }], - "dot-location": ["warn", "property"], - "eqeqeq": ["warn", "smart"], - "new-parens": "warn", - "no-array-constructor": "warn", - "no-caller": "warn", - "no-cond-assign": ["warn", "except-parens"], - "no-const-assign": "warn", - "no-control-regex": "warn", - "no-delete-var": "warn", - "no-dupe-args": "warn", - "no-dupe-class-members": "warn", - "no-dupe-keys": "warn", - "no-duplicate-case": "warn", - "no-empty-character-class": "warn", - "no-empty-pattern": "warn", - "no-eval": "warn", - "no-ex-assign": "warn", - "no-extend-native": "warn", - "no-extra-bind": "warn", - "no-extra-label": "warn", - "no-fallthrough": "warn", - "no-func-assign": "warn", - "no-implied-eval": "warn", - "no-invalid-regexp": "warn", - "no-iterator": "warn", - "no-label-var": "warn", - "no-labels": ["warn", { "allowLoop": true, "allowSwitch": false }], - "no-lone-blocks": "warn", - "no-loop-func": "warn", + "array-callback-return": "error", + "default-case": ["error", { "commentPattern": "^no default$" }], + "dot-location": ["error", "property"], + "eqeqeq": ["error", "smart"], + "new-parens": "error", + "no-array-constructor": "error", + "no-caller": "error", + "no-cond-assign": ["error", "except-parens"], + "no-const-assign": "error", + "no-control-regex": "error", + "no-delete-var": "error", + "no-dupe-args": "error", + "no-dupe-class-members": "error", + "no-dupe-keys": "error", + "no-duplicate-case": "error", + "no-empty-character-class": "error", + "no-empty-pattern": "error", + "no-eval": "error", + "no-ex-assign": "error", + "no-extend-native": "error", + "no-extra-bind": "error", + "no-extra-label": "error", + "no-fallthrough": "error", + "no-func-assign": "error", + "no-implied-eval": "error", + "no-invalid-regexp": "error", + "no-iterator": "error", + "no-label-var": "error", + "no-labels": ["error", { "allowLoop": true, "allowSwitch": false }], + "no-lone-blocks": "error", + "no-loop-func": "error", "no-mixed-operators": [ - "warn", + "error", { "groups": [ ["&", "|", "^", "~", "<<", ">>", ">>>"], @@ -254,37 +254,37 @@ "allowSamePrecedence": false } ], - "no-multi-str": "warn", - "no-native-reassign": "warn", - "no-negated-in-lhs": "warn", - "no-new-func": "warn", - "no-new-object": "warn", - "no-new-symbol": "warn", - "no-new-wrappers": "warn", - "no-obj-calls": "warn", - "no-octal": "warn", - "no-octal-escape": "warn", - "no-regex-spaces": "warn", + "no-multi-str": "error", + "no-native-reassign": "error", + "no-negated-in-lhs": "error", + "no-new-func": "error", + "no-new-object": "error", + "no-new-symbol": "error", + "no-new-wrappers": "error", + "no-obj-calls": "error", + "no-octal": "error", + "no-octal-escape": "error", + "no-regex-spaces": "error", "no-restricted-syntax": [ - "warn", + "error", "WithStatement", { "message": "substr() is deprecated, use slice() or substring() instead", "selector": "MemberExpression > Identifier[name='substr']" } ], - "no-script-url": "warn", - "no-self-assign": "warn", - "no-self-compare": "warn", - "no-sequences": "warn", - "no-shadow-restricted-names": "warn", - "no-sparse-arrays": "warn", + "no-script-url": "error", + "no-self-assign": "error", + "no-self-compare": "error", + "no-sequences": "error", + "no-shadow-restricted-names": "error", + "no-sparse-arrays": "error", "no-template-curly-in-string": "error", - "no-this-before-super": "warn", - "no-throw-literal": "warn", + "no-this-before-super": "error", + "no-throw-literal": "error", "no-undef": "error", - "no-unexpected-multiline": "warn", - "no-unreachable": "warn", + "no-unexpected-multiline": "error", + "no-unreachable": "error", "no-unused-expressions": [ "error", { @@ -293,64 +293,64 @@ "allowTaggedTemplates": true } ], - "no-unused-labels": "warn", + "no-unused-labels": "error", "no-unused-vars": [ - "warn", + "error", { "args": "none", "ignoreRestSiblings": true } ], "no-use-before-define": "off", - "no-useless-computed-key": "warn", - "no-useless-concat": "warn", - "no-useless-constructor": "warn", - "no-useless-escape": "warn", + "no-useless-computed-key": "error", + "no-useless-concat": "error", + "no-useless-constructor": "error", + "no-useless-escape": "error", "no-useless-rename": [ - "warn", + "error", { "ignoreDestructuring": false, "ignoreImport": false, "ignoreExport": false } ], - "no-with": "warn", - "no-whitespace-before-property": "warn", - "react-hooks/exhaustive-deps": "warn", - "require-yield": "warn", - "rest-spread-spacing": ["warn", "never"], - "strict": ["warn", "never"], - "unicode-bom": ["warn", "never"], - "use-isnan": "warn", - "valid-typeof": "warn", - "getter-return": "warn", - "react/forbid-foreign-prop-types": ["warn", { "allowInPropTypes": true }], - "react/jsx-no-comment-textnodes": "warn", - "react/jsx-no-duplicate-props": "warn", - "react/jsx-no-target-blank": "warn", + "no-with": "error", + "no-whitespace-before-property": "error", + "react-hooks/exhaustive-deps": "error", + "require-yield": "error", + "rest-spread-spacing": ["error", "never"], + "strict": ["error", "never"], + "unicode-bom": ["error", "never"], + "use-isnan": "error", + "valid-typeof": "error", + "getter-return": "error", + "react/forbid-foreign-prop-types": ["error", { "allowInPropTypes": true }], + "react/jsx-no-comment-textnodes": "error", + "react/jsx-no-duplicate-props": "error", + "react/jsx-no-target-blank": "error", "react/jsx-no-undef": "error", "react/jsx-pascal-case": [ - "warn", + "error", { "allowAllCaps": true, "ignore": [] } ], - "react/jsx-uses-react": "warn", - "react/jsx-uses-vars": "warn", - "react/no-danger-with-children": "warn", - "react/no-deprecated": "warn", - "react/no-direct-mutation-state": "warn", - "react/no-is-mounted": "warn", + "react/jsx-uses-react": "error", + "react/jsx-uses-vars": "error", + "react/no-danger-with-children": "error", + "react/no-deprecated": "error", + "react/no-direct-mutation-state": "error", + "react/no-is-mounted": "error", "react/no-typos": "error", "react/react-in-jsx-scope": "off", "react/require-render-return": "error", - "react/style-prop-object": "warn", + "react/style-prop-object": "error", "react-hooks/rules-of-hooks": "error", - // "@typescript-eslint/non-nullable-type-assertion-style": "warn", - "@typescript-eslint/prefer-as-const": "warn", + // "@typescript-eslint/non-nullable-type-assertion-style": "error", + "@typescript-eslint/prefer-as-const": "error", "@typescript-eslint/no-redeclare": [ - "warn", + "error", { "builtinGlobals": false, "ignoreDeclarationMerge": true } ] } diff --git a/lint-staged.config.js b/lint-staged.config.js index c08b7f7edd03fe..f9fa19fd31ac3d 100644 --- a/lint-staged.config.js +++ b/lint-staged.config.js @@ -30,7 +30,7 @@ module.exports = { return [ `prettier --with-node-modules --ignore-path .prettierignore --write ${escapedFileNames}`, - `eslint --no-ignore --max-warnings=0 --fix ${escape(eslintFileNames.filter((filename) => filename !== null)).join(' ')}`, + `eslint --no-ignore --fix ${escape(eslintFileNames.filter((filename) => filename !== null)).join(' ')}`, `git add ${escapedFileNames}`, ] }, diff --git a/package.json b/package.json index f36d1a1fad0298..484eb89d0428c3 100644 --- a/package.json +++ b/package.json @@ -33,12 +33,12 @@ "git-clean": "git clean -d -x -e node_modules -e packages -f", "typescript": "tsc --noEmit", "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", "types-and-precompiled": "run-p lint-typescript check-precompiled validate-externals-doc", "validate-externals-doc": "node ./scripts/validate-externals-doc.js", "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 .", "prettier-check": "prettier --check .", "check-examples": "./scripts/check-examples.sh", diff --git a/packages/font/tsconfig.json b/packages/font/tsconfig.json index e5df5eeddf320c..67fc1150335425 100644 --- a/packages/font/tsconfig.json +++ b/packages/font/tsconfig.json @@ -6,7 +6,8 @@ "esModuleInterop": true, "target": "es2019", "outDir": "dist", - "rootDir": "src" + "rootDir": "src", + "skipLibCheck": true }, "include": ["src/**/*.ts"], "exclude": ["node_modules", "src/**/*.test.ts"] diff --git a/packages/next-codemod/tsconfig.json b/packages/next-codemod/tsconfig.json index bad5755406a6af..f2076238915f0c 100644 --- a/packages/next-codemod/tsconfig.json +++ b/packages/next-codemod/tsconfig.json @@ -5,7 +5,8 @@ "esModuleInterop": true, "target": "es2015", "downlevelIteration": true, - "preserveWatchOutput": true + "preserveWatchOutput": true, + "skipLibCheck": true }, "include": ["**/*.ts"], "exclude": ["node_modules"] diff --git a/packages/next-env/package.json b/packages/next-env/package.json index 450ff8eb812baf..886f1e4df503e2 100644 --- a/packages/next-env/package.json +++ b/packages/next-env/package.json @@ -23,7 +23,7 @@ "scripts": { "dev": "ncc build ./index.ts -w -o 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", "build": "pnpm release && pnpm types", "prepublishOnly": "cd ../../ && turbo run build" diff --git a/packages/next-env/tsconfig.json b/packages/next-env/tsconfig.json index d0e9e223e6a05e..a045075fc974ed 100644 --- a/packages/next-env/tsconfig.json +++ b/packages/next-env/tsconfig.json @@ -5,6 +5,8 @@ "strict": true, "resolveJsonModule": true, "esModuleInterop": true, - "skipLibCheck": false - } + "skipLibCheck": true + }, + "include": ["**/*.ts"], + "exclude": ["node_modules", "dist"] } diff --git a/packages/next/tsconfig.json b/packages/next/tsconfig.json index 5a8c5d9bf6a816..673ac87bc3f1b6 100644 --- a/packages/next/tsconfig.json +++ b/packages/next/tsconfig.json @@ -8,7 +8,8 @@ "moduleResolution": "node", "jsx": "react-jsx", "stripInternal": true, - "verbatimModuleSyntax": true + "verbatimModuleSyntax": true, + "skipLibCheck": true }, "exclude": [ "dist", diff --git a/packages/react-refresh-utils/tsconfig.json b/packages/react-refresh-utils/tsconfig.json index bd580ec9271ece..57067d8c8cae85 100644 --- a/packages/react-refresh-utils/tsconfig.json +++ b/packages/react-refresh-utils/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "sourceMap": true, "esModuleInterop": true, + "skipLibCheck": true, "target": "es2015", "lib": ["dom"], "downlevelIteration": true, diff --git a/packages/third-parties/tsconfig.json b/packages/third-parties/tsconfig.json index 0bda91d3514210..07dd62303c0ed1 100644 --- a/packages/third-parties/tsconfig.json +++ b/packages/third-parties/tsconfig.json @@ -7,7 +7,8 @@ "jsx": "react-jsx", "resolveJsonModule": true, "module": "commonjs", - "rootDir": "src" + "rootDir": "src", + "skipLibCheck": true }, "include": ["src/**/*.ts", "src/**/*.tsx"], "exclude": ["node_modules"]