Skip to content

Commit 9ea643d

Browse files
committed
chore: upgrade eslint
1 parent 87647bb commit 9ea643d

13 files changed

Lines changed: 527 additions & 770 deletions

.eslintignore

Lines changed: 0 additions & 3 deletions
This file was deleted.

.eslintrc.js

Lines changed: 0 additions & 37 deletions
This file was deleted.

.vscode/settings.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,6 @@
77
"git blame": true,
88
"sed": true,
99
"yarn": true,
10+
"git check-ignore": true
1011
}
1112
}

eslint.config.cjs

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
const tsEslintPlugin = require('@typescript-eslint/eslint-plugin');
2+
const tsEslintParser = require('@typescript-eslint/parser');
3+
const nPlugin = require('eslint-plugin-n');
4+
const prettierConfig = require('eslint-config-prettier');
5+
6+
module.exports = [
7+
{
8+
ignores: ['.test/**', 'dist/**', 'test/**'],
9+
},
10+
{
11+
files: ['src/**/*.ts'],
12+
languageOptions: {
13+
parser: tsEslintParser,
14+
ecmaVersion: 2018,
15+
sourceType: 'module',
16+
},
17+
plugins: {
18+
'@typescript-eslint': tsEslintPlugin,
19+
n: nPlugin,
20+
},
21+
settings: {
22+
node: {
23+
tryExtensions: ['.js', '.json', '.ts', '.d.ts'],
24+
},
25+
},
26+
rules: {
27+
...nPlugin.configs['flat/recommended-module'].rules,
28+
...tsEslintPlugin.configs.recommended.rules,
29+
...prettierConfig.rules,
30+
'n/no-unsupported-features/es-syntax': 'off',
31+
'@typescript-eslint/no-explicit-any': 'off',
32+
'@typescript-eslint/no-require-imports': 'off',
33+
"@typescript-eslint/no-unused-vars": [
34+
"error",
35+
{
36+
"args": "all",
37+
"argsIgnorePattern": "^_",
38+
"caughtErrors": "all",
39+
"caughtErrorsIgnorePattern": "^_",
40+
"destructuredArrayIgnorePattern": "^_",
41+
"varsIgnorePattern": "^_",
42+
"ignoreRestSiblings": true
43+
}
44+
]
45+
},
46+
},
47+
];

package.json

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"types": "dist",
77
"scripts": {
88
"build": "tsc --version && tsc --project \"./src\"",
9-
"lint": "tsc --project \"./src\" --noEmit && eslint -c .eslintrc.js --ext .ts ./src",
9+
"lint": "tsc --project \"./src\" --noEmit && eslint --ext .ts ./src",
1010
"comparison-tests": "git clean -xfd test/comparison-tests && npm link --legacy-peer-deps ./test/comparison-tests/testLib && node test/comparison-tests/run-tests.js",
1111
"execution-tests": "git clean -xfd test/execution-tests && node test/execution-tests/run-tests.js",
1212
"test": "git clean -xfd test/comparison-tests && git clean -xfd test/execution-tests && node test/run-tests.js",
@@ -40,7 +40,7 @@
4040
"ts"
4141
],
4242
"engines": {
43-
"node": ">=12.0.0"
43+
"node": ">=18.18.0"
4444
},
4545
"author": "John Reilly <johnny_reilly@hotmail.com> (https://johnnyreilly.com)",
4646
"contributors": [
@@ -63,8 +63,8 @@
6363
"@types/micromatch": "^4.0.0",
6464
"@types/node": "*",
6565
"@types/semver": "^7.3.4",
66-
"@typescript-eslint/eslint-plugin": "^6.0.0",
67-
"@typescript-eslint/parser": "^6.0.0",
66+
"@typescript-eslint/eslint-plugin": "^8.0.0",
67+
"@typescript-eslint/parser": "^8.0.0",
6868
"babel": "^6.0.0",
6969
"babel-core": "^6.0.0",
7070
"babel-loader": "^7.0.0",
@@ -73,10 +73,9 @@
7373
"babel-preset-es2016": "^6.16.0",
7474
"babel-preset-react": "^6.0.0",
7575
"escape-string-regexp": "^2.0.0",
76-
"eslint": "^8.0.0",
77-
"eslint-config-prettier": "^8.0.0",
78-
"eslint-plugin-node": "^11.1.0",
79-
"eslint-plugin-prettier": "^4.0.0",
76+
"eslint": "^10.0.0",
77+
"eslint-config-prettier": "^10.0.0",
78+
"eslint-plugin-n": "^17.0.0",
8079
"fs-extra": "^11.0.0",
8180
"glob": "^7.1.1",
8281
"husky": "^8.0.0",

src/compilerSetup.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ export function getCompiler(loaderOptions: LoaderOptions, log: logger.Logger) {
1212

1313
try {
1414
compiler = require(loaderOptions.compiler);
15-
} catch (e) {
15+
} catch (_e) {
1616
errorMessage =
1717
loaderOptions.compiler === 'typescript'
1818
? 'Could not load TypeScript. Try installing with `yarn add typescript` or `npm install typescript`. If TypeScript is installed globally, try using `yarn link typescript` or `npm link typescript`.'

src/config.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,6 @@ export function getParsedCommandLine(
179179
compiler,
180180
loaderOptions
181181
),
182-
// eslint-disable-next-line @typescript-eslint/no-empty-function
183182
onUnRecoverableConfigFileDiagnostic: () => {},
184183
},
185184
extendedConfigCache

src/index.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ function loader(
4040
contents: string,
4141
inputSourceMap?: Record<string, any>
4242
) {
43+
// eslint-disable-next-line @typescript-eslint/no-unused-expressions
4344
this.cacheable && this.cacheable();
4445
const callback = this.async();
4546
const isWebpack5 = typeof this.getOptions === 'function';
@@ -755,6 +756,6 @@ export = loader;
755756
*/
756757
// eslint-disable-next-line @typescript-eslint/no-namespace
757758
namespace loader {
758-
// eslint-disable-next-line @typescript-eslint/no-empty-interface
759+
// eslint-disable-next-line @typescript-eslint/no-empty-object-type
759760
export interface Options extends LoaderOptions {}
760761
}

src/instances.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -265,7 +265,7 @@ function successfulTypeScriptInstance(
265265
});
266266
rootFileNames.add(normalizedFilePath);
267267
});
268-
} catch (exc) {
268+
} catch (_e) {
269269
return {
270270
error: makeError(
271271
loaderOptions,

src/logger.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
/* eslint-disable @typescript-eslint/no-empty-function */
21
import type { Chalk } from 'chalk';
32
import { Console } from 'console';
43
import type { LoaderOptions } from './interfaces';

0 commit comments

Comments
 (0)