Skip to content

Commit 650e9b2

Browse files
committed
chore: migrate to eslint v9 and use flat configs
1 parent a7256a0 commit 650e9b2

File tree

5 files changed

+69
-41
lines changed

5 files changed

+69
-41
lines changed

.eslintrc.json

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

.vscode/settings.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
{
2-
"git.branchProtection": ["main"]
2+
"git.branchProtection": ["main"],
3+
"eslint.useFlatConfig": true
34
}

eslint.config.js

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
// @ts-check
2+
import globals from 'globals';
3+
import eslintPlugin from '@eslint/js';
4+
import jsdocPlugin from 'eslint-plugin-jsdoc';
5+
// @ts-expect-error
6+
import importPlugin from 'eslint-plugin-import';
7+
8+
/** @type {import('eslint').Linter.Config[]} */
9+
export default [
10+
{
11+
files: ['*.js', '*.d.ts']
12+
},
13+
{
14+
ignores: ['scripts/util/secret.js'],
15+
},
16+
{
17+
languageOptions: {
18+
globals: {
19+
...globals.node
20+
}
21+
}
22+
},
23+
{
24+
languageOptions: {
25+
parserOptions: {
26+
ecmaVersion: 13,
27+
sourceType: 'module',
28+
project: './tsconfig.json'
29+
}
30+
},
31+
},
32+
eslintPlugin.configs.recommended,
33+
{
34+
plugins: {
35+
jsdoc: jsdocPlugin,
36+
import: importPlugin
37+
},
38+
rules: {
39+
'no-unused-vars': 'warn',
40+
'no-empty': 'off',
41+
'block-spacing': 'warn',
42+
'arrow-spacing': 'warn',
43+
'space-before-blocks': 'warn',
44+
'keyword-spacing': 'warn',
45+
'no-irregular-whitespace': 'off',
46+
'no-class-assign': 'off',
47+
'jsdoc/no-undefined-types': 1,
48+
'import/no-unresolved': 'error',
49+
'import/no-cycle': 'error',
50+
},
51+
settings: {
52+
'import/resolver': {
53+
node: {
54+
extensions: ['.js', '.ts', '.d.ts']
55+
}
56+
}
57+
}
58+
},
59+
]

package.json

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,9 @@
44
"description": "Anti-cheat addon with ScriptAPI / For Multiplayer, Realms, Servers / Recommended Japanese",
55
"main": "scripts/index.js",
66
"typings": "scripts/types.d.ts",
7+
"type": "module",
78
"scripts": {
8-
"lint": "eslint ./scripts --ext .js & tsc"
9+
"lint": "eslint ./scripts & tsc"
910
},
1011
"repository": {
1112
"type": "git",
@@ -18,11 +19,13 @@
1819
},
1920
"homepage": "https://github.com/tutinoko2048/TNAntiCheat/blob/main/README.md",
2021
"devDependencies": {
22+
"@eslint/js": "^9.13.0",
2123
"@minecraft/server": "1.16.0-beta.1.21.40-stable",
2224
"@minecraft/server-ui": "1.4.0-beta.1.21.40-stable",
23-
"eslint": "^8.56.0",
24-
"eslint-plugin-import": "^2.29.1",
25-
"eslint-plugin-jsdoc": "^46.8.2",
25+
"@types/eslint": "^9.6.1",
26+
"eslint": "^9.13.0",
27+
"eslint-plugin-import": "^2.31.0",
28+
"eslint-plugin-jsdoc": "^50.4.3",
2629
"typescript": "^5.3.3"
2730
},
2831
"overrides": {

scripts/util/bedrock-boost/Vec3.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -280,7 +280,6 @@ export class Vec3 {
280280
const x = axis.x * Math.sin(halfAngle);
281281
const y = axis.y * Math.sin(halfAngle);
282282
const z = axis.z * Math.sin(halfAngle);
283-
// eslint-disable-next-line
284283
const v = this;
285284
// Rotate vector (v) using quaternion
286285
// Simplified direct computation reflecting quaternion rotation and its conjugate effect
@@ -507,7 +506,7 @@ export class Vec3 {
507506
const other = Vec3._from(x, y, z);
508507
return this.x === other.x && this.y === other.y && this.z === other.z;
509508
}
510-
catch (e) {
509+
catch {
511510
return false;
512511
}
513512
}

0 commit comments

Comments
 (0)