Skip to content

Commit 5e5d0ab

Browse files
committed
eslint v9 (#138)
1 parent 33f8c7e commit 5e5d0ab

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

51 files changed

+206
-333
lines changed

.eslintignore

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

.eslintrc.cjs

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

eslint.config.js

Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
import eslint from '@eslint/js'
2+
import tseslint from 'typescript-eslint'
3+
import neostandard from 'neostandard'
4+
5+
export default tseslint.config(
6+
{
7+
ignores: [
8+
'**/node_modules',
9+
'**/{dist,lib,out}',
10+
'**/CMakeFiles',
11+
'**/.build',
12+
'**/test',
13+
'packages/core/src/emnapi'
14+
]
15+
},
16+
eslint.configs.recommended,
17+
tseslint.configs.recommended,
18+
...neostandard({ ts: true }),
19+
{
20+
languageOptions: {
21+
parser: tseslint.parser,
22+
parserOptions: {
23+
projectService: true,
24+
tsconfigRootDir: import.meta.dirname
25+
},
26+
},
27+
rules: {
28+
'prefer-const': 'off',
29+
'spaced-comment': 'off',
30+
'no-new-func': 'off',
31+
'no-implied-eval': 'off',
32+
'no-var': 'off',
33+
camelcase: 'off',
34+
'no-throw-literal': 'off',
35+
'prefer-rest-params': 'off',
36+
'prefer-spread': 'off',
37+
'@typescript-eslint/no-explicit-any': 'off',
38+
'@typescript-eslint/no-implied-eval': 'off',
39+
'@typescript-eslint/restrict-plus-operands': 'off',
40+
'@typescript-eslint/no-unused-vars': ['error', {
41+
args: 'all',
42+
argsIgnorePattern: '^_',
43+
caughtErrors: 'all',
44+
caughtErrorsIgnorePattern: '^_',
45+
destructuredArrayIgnorePattern: '^_',
46+
varsIgnorePattern: '^_',
47+
ignoreRestSiblings: true
48+
}],
49+
'@typescript-eslint/no-namespace': 'off',
50+
'@typescript-eslint/no-var-requires': 'off',
51+
'@typescript-eslint/promise-function-async': 'off',
52+
'@typescript-eslint/no-non-null-assertion': 'off',
53+
'@typescript-eslint/consistent-type-definitions': 'off',
54+
'@typescript-eslint/strict-boolean-expressions': 'off',
55+
'@typescript-eslint/naming-convention': 'off',
56+
'@typescript-eslint/no-dynamic-delete': 'off',
57+
'@typescript-eslint/method-signature-style': 'off',
58+
'@typescript-eslint/prefer-includes': 'off',
59+
'@typescript-eslint/ban-ts-comment': 'off',
60+
'@typescript-eslint/ban-types': 'off',
61+
'@typescript-eslint/consistent-type-imports': 'off',
62+
'@typescript-eslint/consistent-generic-constructors': 'off',
63+
'@typescript-eslint/no-unnecessary-type-assertion': 'off',
64+
'@typescript-eslint/no-unsafe-argument': 'off',
65+
'@typescript-eslint/unbound-method': 'off',
66+
'@typescript-eslint/no-empty-interface': 'off',
67+
'@typescript-eslint/no-empty-object-type': 'off',
68+
'@typescript-eslint/no-unsafe-function-type': 'off',
69+
'@typescript-eslint/no-require-imports': 'off',
70+
'@stylistic/member-delimiter-style': ['error', {
71+
multiline: {
72+
delimiter: 'none',
73+
requireLast: true
74+
},
75+
singleline: {
76+
delimiter: 'semi',
77+
requireLast: false
78+
}
79+
}],
80+
'@stylistic/spaced-comment': ['error', 'always', {
81+
line: {
82+
markers: ['/'],
83+
},
84+
block: {
85+
markers: ['#__PURE__'],
86+
},
87+
}]
88+
}
89+
},
90+
{
91+
files: ['packages/emnapi/**'],
92+
rules: {
93+
'@typescript-eslint/no-unused-vars': 'off',
94+
}
95+
},
96+
{
97+
files: ['**/*.js', '**/*.cjs', '**/*.mjs'],
98+
extends: [tseslint.configs.disableTypeChecked]
99+
}
100+
)

package.json

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
"test:version": "node ./packages/test/script/test-build-all-napi-version.js",
1515
"release": "node ./script/release.js",
1616
"bump": "npm version -w packages/emnapi -w packages/runtime -w packages/core -w packages/node -w packages/ts-transform-emscripten-parse-tools",
17-
"lint": "eslint \"packages/**/*.ts\""
17+
"lint": "eslint"
1818
},
1919
"author": "toyobayashi",
2020
"repository": {
@@ -30,7 +30,8 @@
3030
},
3131
"license": "MIT",
3232
"devDependencies": {
33-
"@microsoft/api-extractor": "^7.49.1",
33+
"@eslint/js": "^9.23.0",
34+
"@microsoft/api-extractor": "^7.52.2",
3435
"@rollup/plugin-alias": "^5.1.1",
3536
"@rollup/plugin-node-resolve": "^16.0.0",
3637
"@rollup/plugin-replace": "^6.0.2",
@@ -41,17 +42,13 @@
4142
"@tybys/tsapi": "^0.6.0",
4243
"@types/fs-extra": "^11.0.4",
4344
"@types/node": "^22.10.7",
44-
"@typescript-eslint/eslint-plugin": "^6.21.0",
45-
"@typescript-eslint/parser": "^6.21.0",
46-
"eslint": "^8.57.0",
47-
"eslint-config-standard-with-typescript": "^43.0.1",
48-
"eslint-plugin-import": "^2.29.1",
49-
"eslint-plugin-n": "^16.6.2",
50-
"eslint-plugin-promise": "^6.4.0",
45+
"eslint": "^9.23.0",
46+
"neostandard": "^0.12.1",
5147
"fs-extra": "^11.2.0",
5248
"glob": "^10.4.5",
5349
"rollup": "^4.31.0",
54-
"typescript": "~5.7.2"
50+
"typescript": "~5.8.2",
51+
"typescript-eslint": "^8.28.0"
5552
},
5653
"workspaces": [
5754
"packages/shared",

packages/bench/index.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
if (typeof require === 'function') {
2-
// eslint-disable-next-line no-var
32
var Benchmark = require('benchmark')
43
}
54

packages/core/rollup.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { defineConfig } from '@emnapi/shared'
2-
import pkg from './package.json' with { type: "json" }
2+
import pkg from './package.json' with { type: 'json' }
33

44
export default defineConfig({
55
outputName: 'emnapiCore',

packages/core/src/load.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@ function loadNapiModuleImpl<T> (
3838
options?: LoadOptions | InstantiateOptions
3939
): InstantiatedSource
4040
function loadNapiModuleImpl (loadFn: Function, userNapiModule: NapiModule | undefined, wasmInput: InputType | Promise<InputType>, options?: any): any {
41-
// eslint-disable-next-line @typescript-eslint/consistent-type-assertions
4241
options = options ?? {} as InstantiateOptions
4342

4443
const getMemory = options!.getMemory

packages/core/src/util.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
/* eslint-disable no-undef */
2-
31
declare const WXWebAssembly: typeof WebAssembly | undefined
42
declare const wx: any
53
declare const __wxConfig: any

packages/emnapi/script/preprocess.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ class Compilation {
157157
}
158158

159159
_evalCondition (/** @type {string} */ condition) {
160-
condition = condition.replace(/defined\((.+?)\)/g, (substring, one) => {
160+
condition = condition.replace(/defined\((.+?)\)/g, (_substring, one) => {
161161
return `(${typeof this.defines[one] !== 'undefined'})`
162162
})
163163
try {
@@ -272,7 +272,7 @@ class Compilation {
272272
return currentIf.line
273273
}
274274

275-
_errorDirective (lineNumber, error) {
275+
_errorDirective (_lineNumber, error) {
276276
throw new Error(`#error: ${error}`)
277277
}
278278
}

packages/emnapi/src/async-work.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,6 @@ export var emnapiAWST = {
8686
},
8787

8888
callComplete: function (work: AsyncWork, status: napi_status): void {
89-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
9089
const complete = work.complete
9190
const env = work.env
9291
const data = work.data
@@ -125,7 +124,6 @@ export var emnapiAWST = {
125124
emnapiAWST.queued.add(id)
126125
const env = work.env
127126
const data = work.data
128-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
129127
const execute = work.execute
130128
work.status = 2
131129
emnapiCtx.feature.setImmediate(() => {

0 commit comments

Comments
 (0)