Skip to content

Commit

Permalink
Update to typescript-eslint v8 (#1082)
Browse files Browse the repository at this point in the history
  • Loading branch information
jakebailey authored Oct 22, 2024
1 parent 0d8082f commit 5f556cf
Show file tree
Hide file tree
Showing 15 changed files with 1,543 additions and 2,240 deletions.
6 changes: 6 additions & 0 deletions .changeset/lemon-cats-judge.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"@definitelytyped/eslint-plugin": patch
"@definitelytyped/dtslint": patch
---

Update to typescript-eslint v8
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,16 @@
"@types/jest": "^29.5.11",
"@types/node": "^18.19.7",
"@types/yargs": "^17.0.32",
"@typescript-eslint/eslint-plugin": "^7.14.1",
"@typescript-eslint/parser": "^7.14.1",
"eslint": "^8.57.0",
"@typescript-eslint/eslint-plugin": "^8.11.0",
"@typescript-eslint/parser": "^8.11.0",
"eslint": "^8.57.1",
"eslint-plugin-import": "^2.29.1",
"eslint-plugin-jsdoc": "^48.0.2",
"jest": "^29.7.0",
"knip": "^4.0.2",
"prettier": "^3.2.2",
"ts-jest": "^29.1.1",
"typescript": "^5.5.2"
"typescript": "^5.6.3"
},
"pnpm": {
"overrides": {
Expand Down
2 changes: 1 addition & 1 deletion packages/definitions-parser/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
},
"devDependencies": {
"@types/pacote": "^11.1.8",
"typescript": "^5.5.2"
"typescript": "^5.6.3"
},
"peerDependencies": {
"typescript": "*"
Expand Down
2 changes: 1 addition & 1 deletion packages/dts-critic/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
},
"dependencies": {
"@definitelytyped/header-parser": "workspace:*",
"typescript": "^5.5.2",
"typescript": "^5.6.3",
"yargs": "^17.7.2"
},
"peerDependencies": {
Expand Down
2 changes: 1 addition & 1 deletion packages/dts-gen/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
"dependencies": {
"dts-dom": "^3.7.0",
"parse-git-config": "^3.0.0",
"typescript": "^5.5.2",
"typescript": "^5.6.3",
"yargs": "^17.7.2"
},
"devDependencies": {
Expand Down
14 changes: 7 additions & 7 deletions packages/dtslint/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,12 @@
"@definitelytyped/typescript-packages": "workspace:*",
"@definitelytyped/typescript-versions": "workspace:*",
"@definitelytyped/utils": "workspace:*",
"@typescript-eslint/eslint-plugin": "^7.14.1",
"@typescript-eslint/parser": "^7.14.1",
"@typescript-eslint/types": "^7.14.1",
"@typescript-eslint/typescript-estree": "^7.14.1",
"@typescript-eslint/utils": "^7.14.1",
"eslint": "^8.57.0",
"@typescript-eslint/eslint-plugin": "^8.11.0",
"@typescript-eslint/parser": "^8.11.0",
"@typescript-eslint/types": "^8.11.0",
"@typescript-eslint/typescript-estree": "^8.11.0",
"@typescript-eslint/utils": "^8.11.0",
"eslint": "^8.57.1",
"eslint-plugin-import": "^2.29.1",
"semver": "^7.5.4",
"strip-json-comments": "^3.1.1"
Expand All @@ -45,7 +45,7 @@
"@types/eslint": "^8.56.2",
"@types/semver": "^7.5.5",
"@types/strip-json-comments": "^3.0.0",
"typescript": "^5.5.2"
"typescript": "^5.6.3"
},
"engines": {
"node": ">=18.18.0"
Expand Down
14 changes: 7 additions & 7 deletions packages/eslint-plugin/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,18 +19,18 @@
},
"scripts": {
"build": "tsc -b .",
"test": "../../node_modules/.bin/jest --config ../../jest.config.js packages/dtslint"
"test": "../../node_modules/.bin/jest --config ../../jest.config.js packages/eslint-plugin"
},
"dependencies": {
"@definitelytyped/utils": "workspace:*",
"@typescript-eslint/types": "^7.14.1",
"@typescript-eslint/utils": "^7.14.1",
"@typescript-eslint/types": "^8.11.0",
"@typescript-eslint/utils": "^8.11.0",
"semver": "^7.5.4"
},
"peerDependencies": {
"@typescript-eslint/eslint-plugin": "^7.14.1",
"@typescript-eslint/parser": "^7.14.1",
"eslint": "^8.40.0",
"@typescript-eslint/eslint-plugin": "^8.10.0",
"@typescript-eslint/parser": "^8.10.0",
"eslint": "^8.57.0",
"eslint-plugin-jsdoc": "^44.0.0",
"typescript": ">= 3.0.0-dev || >= 3.1.0-dev || >= 3.2.0-dev || >= 3.3.0-dev || >= 3.4.0-dev || >= 3.5.0-dev || >= 3.6.0-dev || >= 3.7.0-dev || >= 3.8.0-dev || >= 3.9.0-dev || >= 4.0.0-dev || >=5.0.0-dev"
},
Expand All @@ -41,7 +41,7 @@
"glob": "^10.3.10",
"jest-file-snapshot": "^0.5.0",
"strip-ansi": "^6.0.1",
"typescript": "^5.5.2",
"typescript": "^5.6.3",
"typescript-5.4": "npm:typescript@~5.4.0-0",
"typescript-5.5": "npm:typescript@~5.5.0-0"
},
Expand Down
9 changes: 2 additions & 7 deletions packages/eslint-plugin/src/configs/all.ts
Original file line number Diff line number Diff line change
Expand Up @@ -154,13 +154,8 @@ export const all: Linter.BaseConfig = {
},
],
"@typescript-eslint/adjacent-overload-signatures": "error",
"@typescript-eslint/ban-types": [
"error",
{
types: { "{}": false },
extendDefaults: true,
},
],
"@typescript-eslint/no-wrapper-object-types": "error",
"@typescript-eslint/no-unsafe-function-type": "error",
"@typescript-eslint/prefer-namespace-keyword": "error",
"@typescript-eslint/triple-slash-reference": ["error", { types: "prefer-import", path: "always" }],
"@typescript-eslint/no-empty-interface": "error",
Expand Down
6 changes: 5 additions & 1 deletion packages/eslint-plugin/src/rules/no-type-only-packages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,11 @@ const rule = createRule({
let hasNonEmptyFile = false;

function isOutsidePackage(fileName: string): boolean {
return fileName.includes("node_modules") || path.relative(pkg!.dir, fileName).startsWith("..");
if (fileName.includes("node_modules") || path.relative(pkg!.dir, fileName).startsWith("..")) {
return true;
}
const other = findTypesPackage(fileName);
return !other || other.dir !== pkg!.dir;
}

for (const sourceFile of program.getSourceFiles()) {
Expand Down
11 changes: 2 additions & 9 deletions packages/eslint-plugin/test/__snapshots__/plugin.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -48,15 +48,6 @@ exports[`plugin should have the expected exports 1`] = `
"ts-nocheck": true,
},
],
"@typescript-eslint/ban-types": [
"error",
{
"extendDefaults": true,
"types": {
"{}": false,
},
},
],
"@typescript-eslint/consistent-type-definitions": "error",
"@typescript-eslint/explicit-member-accessibility": [
"error",
Expand Down Expand Up @@ -84,6 +75,8 @@ exports[`plugin should have the expected exports 1`] = `
},
],
"@typescript-eslint/no-misused-new": "error",
"@typescript-eslint/no-unsafe-function-type": "error",
"@typescript-eslint/no-wrapper-object-types": "error",
"@typescript-eslint/prefer-namespace-keyword": "error",
"@typescript-eslint/triple-slash-reference": [
"error",
Expand Down
18 changes: 5 additions & 13 deletions packages/eslint-plugin/test/eslint.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,23 +25,15 @@ function getAllExpectedLintSnapshots() {
return new Set(allFixtures.map(getLintSnapshotPath));
}

let eslint: ESLint;

beforeAll(() => {
eslint = new ESLint({
cwd: fixtureRoot,
plugins: { [plugin.meta.name]: plugin },
});
});

afterAll(() => {
eslint = undefined as any;
});

// Force one test per fixture so we can see when a file has no errors.
for (const fixture of allFixtures) {
describe(`fixture ${fixture}`, () => {
it("should lint", async () => {
const eslint = new ESLint({
cwd: fixtureRoot,
plugins: { [plugin.meta.name]: plugin },
});

const results = await eslint.lintFiles([fixture]);
for (const result of results) {
result.filePath = path.relative(fixtureRoot, result.filePath);
Expand Down
2 changes: 0 additions & 2 deletions packages/mergebot/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@
"apollo": "^2.34.0",
"azure-functions-core-tools": "^4.0.5700",
"esbuild": "^0.21.5",
"eslint": "^8.57.0",
"jest": "^29.7.0",
"jest-file-snapshot": "^0.5.0",
"knip": "^5.15.1",
Expand Down Expand Up @@ -67,7 +66,6 @@
"update-test-data": "pnpm run build && node dist/commands/update-test-data.js",
"update-all-fixtures": "pnpm run build && node dist/commands/update-all-fixtures.js",
"start": "func start",
"lint": "eslint --report-unused-disable-directives . --ext .ts",
"test": "jest"
},
"jest": {
Expand Down
2 changes: 1 addition & 1 deletion packages/publisher/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"longjohn": "^0.2.12",
"pacote": "^17.0.5",
"semver": "^7.5.4",
"typescript": "^5.5.2",
"typescript": "^5.6.3",
"yargs": "^17.7.2"
},
"devDependencies": {
Expand Down
Loading

0 comments on commit 5f556cf

Please sign in to comment.