Skip to content

Commit f9b1d01

Browse files
committed
Install typescript-eslint in preparation for more TypeScript
1 parent 787d595 commit f9b1d01

File tree

4 files changed

+123
-21
lines changed

4 files changed

+123
-21
lines changed

bun.lock

Lines changed: 74 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

eslint.config.js

Lines changed: 36 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1+
import globals from 'globals';
12
import js from '@eslint/js';
3+
import ts from 'typescript-eslint';
24

35
const rules = {
46
rules: {
@@ -16,10 +18,10 @@ const rules = {
1618
"eqeqeq": ["error", "smart"],
1719
"func-call-spacing": ["warn", "never"],
1820
"grouped-accessor-pairs": "error",
19-
"indent": ["off", 4],
21+
"indent": ["off", 2],
2022
"keyword-spacing": "error",
2123
"linebreak-style": ["error", "unix"],
22-
"no-await-in-loop": "error",
24+
"no-await-in-loop": "off",
2325
"no-caller": "error",
2426
"no-catch-shadow": "error",
2527
"no-console": "warn",
@@ -34,14 +36,15 @@ const rules = {
3436
"no-floating-decimal": "error",
3537
"no-global-assign": "error",
3638
"no-implied-eval": "error",
37-
"no-invalid-this": "off",
39+
"no-invalid-this": "error",
3840
"no-iterator": "error",
3941
"no-labels": "error",
4042
"no-label-var": "error",
4143
"no-lone-blocks": "error",
4244
"no-loop-func": "error",
4345
"no-loss-of-precision": "error",
4446
"no-multi-str": "error",
47+
"no-native-reassign": "error",
4548
"no-new": "error",
4649
"no-new-func": "error",
4750
"no-new-wrappers": "error",
@@ -70,7 +73,7 @@ const rules = {
7073
"no-unreachable": "warn",
7174
"no-unreachable-loop": "warn",
7275
"no-unused-expressions": "error",
73-
"no-unused-vars": ["warn", { "vars": "all", "args": "none", "caughtErrors": "none" }],
76+
"no-unused-vars": "off", // typescript-eslint will check it
7477
"no-use-before-define": ["off", "nofunc"],
7578
"no-useless-backreference": "warn",
7679
"no-useless-call": "warn",
@@ -83,19 +86,44 @@ const rules = {
8386
"no-warning-comments": "warn",
8487
"no-whitespace-before-property": "warn",
8588
"no-with": "error",
86-
"quotes": ["error", "single", { "allowTemplateLiterals": true }],
8789
"radix": ["error", "always"],
8890
"require-atomic-updates": "error",
8991
"require-await": "error",
9092
"semi": ["error", "always"],
9193
"semi-spacing": "error",
9294
"space-unary-ops": "error",
93-
"wrap-regex": "off"
95+
"wrap-regex": "off",
96+
97+
"@typescript-eslint/array-type": "off",
98+
"@typescript-eslint/no-empty-function": "off",
99+
"@typescript-eslint/no-explicit-any": "warn",
100+
"@typescript-eslint/no-inferrable-types": ["warn", { "ignoreParameters": true }],
101+
"@typescript-eslint/no-unused-vars": ["warn", { "vars": "all", "args": "none", "caughtErrors": "none", "destructuredArrayIgnorePattern": "^_" }]
94102
}
95103
};
96104

97105
export default [
98106
js.configs.recommended,
99-
rules
107+
...ts.configs.recommended,
108+
...ts.configs.stylistic,
109+
rules,
110+
{
111+
files: [ '**/*.{js,ts}' ],
112+
languageOptions: {
113+
globals: {
114+
...globals.browser
115+
}
116+
}
117+
},
118+
{
119+
files: [ 'scripts/*', 'test/*' ],
120+
languageOptions: {
121+
globals: {
122+
Bun: false
123+
}
124+
},
125+
rules: {
126+
"no-console": "off"
127+
}
128+
}
100129
];
101-

package.json

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,15 +31,20 @@
3131
"scripts": {
3232
"all": "run-s clean lint build:js test",
3333
"clean": "bun ./scripts/clean.ts",
34+
"build": "run-p build:js build:ts",
3435
"build:js": "bun ./scripts/build_js.ts",
35-
"test": "bun test --dots --coverage ./test/*.js",
36-
"lint": "eslint ./src/diff3.mjs ./test/*.js"
36+
"build:ts": "tsc",
37+
"lint": "eslint ./scripts ./src ./test",
38+
"test": "bun test --dots --coverage ./test"
3739
},
3840
"devDependencies": {
3941
"@eslint/js": "^9.38.0",
4042
"@types/bun": "^1.3.1",
4143
"eslint": "^9.38.0",
42-
"npm-run-all2": "^8.0.4"
44+
"globals": "^16.4.0",
45+
"npm-run-all2": "^8.0.4",
46+
"typescript-eslint": "^8.46.2",
47+
"typescript": "^5.9.3"
4348
},
4449
"sideEffects": false,
4550
"publishConfig": {

0 commit comments

Comments
 (0)