Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump eslint from 8.57.0 to 9.9.1 #432

Merged
merged 2 commits into from
Aug 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions .yarn/versions/e3e7100d.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
releases:
"@solarwinds-apm/eslint-config": major
"@solarwinds-apm/module": patch
solarwinds-apm: patch

declined:
- "@solarwinds-apm/bindings"
- "@solarwinds-apm/compat"
- "@solarwinds-apm/dependencies"
- "@solarwinds-apm/histogram"
- "@solarwinds-apm/instrumentations"
- "@solarwinds-apm/lazy"
- "@solarwinds-apm/proto"
- "@solarwinds-apm/rollup-config"
- "@solarwinds-apm/sampling"
- "@solarwinds-apm/sdk"
- "@solarwinds-apm/test"
5 changes: 4 additions & 1 deletion examples/eslint.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,7 @@ limitations under the License.

import base from "@solarwinds-apm/eslint-config"

export default [...base, { ignores: ["next-prisma/**"] }]
export default [
...base({ allowDefaultProject: [] }),
{ ignores: ["next-prisma/**"] },
]
2 changes: 1 addition & 1 deletion examples/next-prisma/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"devDependencies": {
"@types/node": "^16.13.0",
"@types/react": "^18.2.25",
"eslint": "^8.50.0",
"eslint": "^8.57.0",
"eslint-config-next": "^14.0.3",
"prisma": "^5.4.1",
"typescript": "~5.5.3"
Expand Down
5 changes: 3 additions & 2 deletions examples/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
},
"devDependencies": {
"@solarwinds-apm/eslint-config": "workspace:^",
"eslint": "^8.50.0",
"prettier": "^3.0.3"
"eslint": "^9.9.1",
"prettier": "^3.3.3",
"typescript": "~5.5.3"
}
}
7 changes: 7 additions & 0 deletions examples/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"extends": "./tsconfig.base.test.json",
"compilerOptions": {
"allowJs": true,
"checkJs": false
}
}
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@
"prepare": "husky"
},
"devDependencies": {
"eslint": "^8.50.0",
"eslint": "^9.9.1",
"husky": "^9.0.11",
"prettier": "^3.0.3",
"prettier": "^3.3.3",
"turbo": "^2.0.9",
"typescript": "~5.5.3"
}
Expand Down
2 changes: 1 addition & 1 deletion packages/bindings/eslint.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@ limitations under the License.

const base = require("@solarwinds-apm/eslint-config")

module.exports = [...base]
module.exports = [...base({ allowDefaultProject: [] })]
4 changes: 2 additions & 2 deletions packages/bindings/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,9 @@
"@solarwinds-apm/eslint-config": "workspace:^",
"@solarwinds-apm/test": "workspace:^",
"@types/node": "^16.13.0",
"eslint": "^8.50.0",
"eslint": "^9.9.1",
"node-addon-api": "^8.1.0",
"prettier": "^3.0.3",
"prettier": "^3.3.3",
"typescript": "~5.5.3",
"zig-build": "^0.3.0"
},
Expand Down
2 changes: 1 addition & 1 deletion packages/compat/eslint.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@ limitations under the License.

import base from "@solarwinds-apm/eslint-config"

export default [...base]
export default [...base()]
4 changes: 2 additions & 2 deletions packages/compat/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@
"@solarwinds-apm/rollup-config": "workspace:^",
"@solarwinds-apm/test": "workspace:^",
"@types/node": "^16.13.0",
"eslint": "^8.50.0",
"prettier": "^3.0.3",
"eslint": "^9.9.1",
"prettier": "^3.3.3",
"rollup": "^4.3.0",
"typescript": "~5.5.3"
},
Expand Down
2 changes: 1 addition & 1 deletion packages/dependencies/eslint.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@ limitations under the License.

import base from "@solarwinds-apm/eslint-config"

export default [...base]
export default [...base()]
4 changes: 2 additions & 2 deletions packages/dependencies/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@
"@solarwinds-apm/rollup-config": "workspace:^",
"@solarwinds-apm/test": "workspace:^",
"@types/node": "^16.13.0",
"eslint": "^8.50.0",
"prettier": "^3.0.3",
"eslint": "^9.9.1",
"prettier": "^3.3.3",
"rollup": "^4.3.0",
"typescript": "~5.5.3"
},
Expand Down
2 changes: 1 addition & 1 deletion packages/eslint-config/eslint.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@ limitations under the License.

const base = require(".")

module.exports = [...base]
module.exports = [...base()]
162 changes: 87 additions & 75 deletions packages/eslint-config/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,15 @@ See the License for the specific language governing permissions and
limitations under the License.
*/

const path = require("node:path")

const js = require("@eslint/js")
const ts = require("typescript-eslint")
const prettier = require("eslint-config-prettier")
const imports = require("eslint-plugin-simple-import-sort")
const header = require("eslint-plugin-header")
const tsdoc = require("eslint-plugin-tsdoc")
const deprecation = require("eslint-plugin-deprecation")
const globals = require("globals")
const notice = require("eslint-plugin-notice")

const noticeTemplate = `
const licenseTemplate = `
Copyright [yyyy] [name of copyright owner]

Licensed under the Apache License, Version 2.0 (the "License");
Expand All @@ -47,82 +46,95 @@ const year =

const holder = "SolarWinds Worldwide, LLC."

const notice = noticeTemplate
const license = licenseTemplate
.replace("[yyyy]", year)
.replace("[name of copyright owner]", holder)
.trim()

// don't count variables starting with an underscore as unused
const unusedOptions = {
vars: "all",
varsIgnorePattern: "^_",
args: "all",
argsIgnorePattern: "^_",
caughtErrors: "all",
caughtErrorsIgnorePattern: "^_",
ignoreRestSiblings: false,
}
module.exports = ({ allowDefaultProject = ["*.js", "*.cjs", "*.mjs"] } = {}) =>
ts.config(
// dist folder is always ignored
{ ignores: ["dist/**"] },
// all files use typescript-eslint as a baseline
{
files: [
"**/*.js",
"**/*.cjs",
"**/*.mjs",
"**/*.ts",
"**/*.cts",
"**/*.mts",
],
extends: [
js.configs.recommended,
...ts.configs.stylistic,
...ts.configs.strict,
],
plugins: { imports, notice },
languageOptions: {
parserOptions: {
projectService: {
allowDefaultProject,
defaultProject: path.join(__dirname, "../../tsconfig.base.json"),
},
},
},
rules: {
"imports/imports": "warn",
"imports/exports": "warn",
"notice/notice": ["error", { template: `/*\n${license}\n*/\n\n` }],

module.exports = ts.config(
// dist folder is always generated
{ ignores: ["dist/**"] },
// extend from eslint's recommendations as a baseline
js.configs.recommended,
// js files assume node environment with es2022
{
files: ["**/*.js"],
languageOptions: {
ecmaVersion: 13,
globals: { ...globals.es2021, ...globals.node },
},
rules: {
"no-unused-vars": ["warn", unusedOptions],
},
},
// ts files use typescript-eslint and some extra rules
{
files: ["**/*.ts"],
extends: [
...ts.configs.strictTypeChecked,
...ts.configs.stylisticTypeChecked,
],
languageOptions: {
parserOptions: {
EXPERIMENTAL_useProjectService: true,
"@typescript-eslint/no-non-null-assertion": "off",
"@typescript-eslint/no-require-imports": "off",
// don't count variables starting with an underscore as unused
"@typescript-eslint/no-unused-vars": [
"warn",
{
vars: "all",
varsIgnorePattern: "^_",
args: "all",
argsIgnorePattern: "^_",
caughtErrors: "all",
caughtErrorsIgnorePattern: "^_",
ignoreRestSiblings: false,
},
],
},
},
plugins: { tsdoc, deprecation },
rules: {
"@typescript-eslint/no-non-null-assertion": "off",
"@typescript-eslint/no-unused-vars": ["warn", unusedOptions],
"@typescript-eslint/consistent-type-imports": [
"warn",
{
prefer: "type-imports",
fixStyle: "inline-type-imports",
disallowTypeAnnotations: false,
},
],
"@typescript-eslint/prefer-literal-enum-member": "off",
"@typescript-eslint/restrict-template-expressions": [
"warn",
{
allowNumber: true,
},
// ts files use extra rules enabled by type checking
{
files: ["**/*.ts", "**/*.cts", "**/*.mts"],
extends: [
...ts.configs.stylisticTypeCheckedOnly,
...ts.configs.strictTypeCheckedOnly,
],
"tsdoc/syntax": "warn",
"deprecation/deprecation": "warn",
rules: {
"@typescript-eslint/consistent-type-imports": [
"warn",
{
prefer: "type-imports",
fixStyle: "inline-type-imports",
disallowTypeAnnotations: false,
},
],
"@typescript-eslint/prefer-literal-enum-member": "off",
"@typescript-eslint/restrict-template-expressions": [
"warn",
{
allowNumber: true,
},
],
"@typescript-eslint/no-deprecated": "warn",
"@typescript-eslint/no-require-imports": "error",
},
},
},
// imports and license notices
{
files: ["**/*.js", "**/*.ts"],
plugins: { imports, header },
rules: {
"imports/imports": "warn",
"imports/exports": "warn",
"header/header": ["error", "block", notice, 2],
// chai assertions in tests are treated as unused expressions
{
files: ["**/*.test.*"],
rules: {
"@typescript-eslint/no-unused-expressions": "off",
},
},
},
// disable rules that conflict with prettier
prettier,
)
// disable rules that conflict with prettier
prettier,
)
22 changes: 10 additions & 12 deletions packages/eslint-config/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,17 +31,14 @@
"release": "node ../../scripts/publish.js"
},
"dependencies": {
"@eslint/js": "^8.51.0",
"eslint-config-prettier": "^9.0.0",
"eslint-plugin-deprecation": "^3.0.0",
"eslint-plugin-header": "^3.1.1",
"eslint-plugin-simple-import-sort": "^12.0.0",
"eslint-plugin-tsdoc": "^0.3.0",
"globals": "^15.0.0",
"typescript-eslint": "^7.0.2"
"@eslint/js": "^9.9.1",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-notice": "^1.0.0",
"eslint-plugin-simple-import-sort": "^12.1.1",
"typescript-eslint": "^8.3.0"
},
"peerDependencies": {
"eslint": "^8.56.0",
"eslint": "^9.0.0",
"prettier": "^3.0.0",
"typescript": ">=4.7.4"
},
Expand All @@ -53,11 +50,12 @@
"optional": true
},
"typescript": {
"optional": true
"optional": false
}
},
"devDependencies": {
"eslint": "^8.50.0",
"prettier": "^3.0.3"
"eslint": "^9.9.1",
"prettier": "^3.3.3",
"typescript": "~5.5.3"
}
}
2 changes: 1 addition & 1 deletion packages/histogram/eslint.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@ limitations under the License.

import base from "@solarwinds-apm/eslint-config"

export default [...base]
export default [...base()]
4 changes: 2 additions & 2 deletions packages/histogram/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@
"@solarwinds-apm/eslint-config": "workspace:^",
"@solarwinds-apm/rollup-config": "workspace:^",
"@types/node": "^16.13.0",
"eslint": "^8.50.0",
"prettier": "^3.0.3",
"eslint": "^9.9.1",
"prettier": "^3.3.3",
"rollup": "^4.3.0",
"typescript": "~5.5.3"
},
Expand Down
2 changes: 1 addition & 1 deletion packages/instrumentations/eslint.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@ limitations under the License.

import base from "@solarwinds-apm/eslint-config"

export default [...base]
export default [...base()]
5 changes: 3 additions & 2 deletions packages/instrumentations/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -90,11 +90,12 @@
}
},
"devDependencies": {
"@opentelemetry/api": "^1.3.0",
"@solarwinds-apm/eslint-config": "workspace:^",
"@solarwinds-apm/rollup-config": "workspace:^",
"@types/semver": "^7.5.3",
"eslint": "^8.50.0",
"prettier": "^3.0.3",
"eslint": "^9.9.1",
"prettier": "^3.3.3",
"rollup": "^4.3.0",
"semver": "^7.5.4",
"typescript": "~5.5.3"
Expand Down
2 changes: 1 addition & 1 deletion packages/lazy/eslint.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@ limitations under the License.

import base from "@solarwinds-apm/eslint-config"

export default [...base]
export default [...base()]
Loading