Skip to content

Commit

Permalink
eslint
Browse files Browse the repository at this point in the history
  • Loading branch information
toyobayashi committed Dec 31, 2023
1 parent 340641a commit 0660480
Show file tree
Hide file tree
Showing 3 changed files with 66 additions and 44 deletions.
3 changes: 2 additions & 1 deletion .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,9 @@ node_modules
/test/CMakeFiles
/packages/runtime/lib
/packages/emnapi/lib
/packages/core/src/index.js
/packages/core/src/module.js
/packages/**/test/**/input
/packages/**/test/**/actual
/packages/**/test/**/expected
/packages/**/test/**/rollup/src
/out
106 changes: 63 additions & 43 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,55 +1,75 @@
const sharedRules = {
'spaced-comment': 'off',
'no-new-func': 'off',
'no-implied-eval': 'off',
'no-var': 'off'
}

module.exports = {
root: true,
env: {
node: true,
browser: true
},
parser: '@typescript-eslint/parser',
extends: [
'standard-with-typescript'
'standard'
],
rules: {
'spaced-comment': 'off',
'no-new-func': 'off',
'no-implied-eval': 'off',
'no-var': 'off',
'@typescript-eslint/no-implied-eval': 'off',
'@typescript-eslint/restrict-plus-operands': 'off',
'@typescript-eslint/no-unused-vars': 'error',
'@typescript-eslint/no-namespace': 'off',
'@typescript-eslint/no-var-requires': 'off',
'@typescript-eslint/promise-function-async': 'off',
'@typescript-eslint/no-non-null-assertion': 'off',
'@typescript-eslint/consistent-type-definitions': 'off',
'@typescript-eslint/strict-boolean-expressions': 'off',
'@typescript-eslint/naming-convention': 'off',
'@typescript-eslint/no-dynamic-delete': 'off',
'@typescript-eslint/method-signature-style': 'off',
'@typescript-eslint/prefer-includes': 'off',
'@typescript-eslint/ban-ts-comment': 'off',
'@typescript-eslint/ban-types': 'off',
'@typescript-eslint/consistent-type-imports': 'off',
'@typescript-eslint/consistent-generic-constructors': 'off',
'@typescript-eslint/no-unnecessary-type-assertion': 'off',
'@typescript-eslint/member-delimiter-style': ['error', {
multiline: {
delimiter: 'none',
requireLast: true
},
singleline: {
delimiter: 'semi',
requireLast: false
}
}]
},
parserOptions: {
ecmaVersion: 2019,
sourceType: 'script',
project: './tsconfig.json',
tsconfigRootDir: __dirname,
createDefaultProgram: true
...sharedRules
},
globals: {
emnapi: false
}
emnapi: false,
__VERSION__: false
},
overrides: [
{
files: [
'./packages/**/*.ts'
],
parser: '@typescript-eslint/parser',
extends: [
'standard-with-typescript'
],
rules: {
...sharedRules,
'@typescript-eslint/no-implied-eval': 'off',
'@typescript-eslint/restrict-plus-operands': 'off',
'@typescript-eslint/no-unused-vars': 'error',
'@typescript-eslint/no-namespace': 'off',
'@typescript-eslint/no-var-requires': 'off',
'@typescript-eslint/promise-function-async': 'off',
'@typescript-eslint/no-non-null-assertion': 'off',
'@typescript-eslint/consistent-type-definitions': 'off',
'@typescript-eslint/strict-boolean-expressions': 'off',
'@typescript-eslint/naming-convention': 'off',
'@typescript-eslint/no-dynamic-delete': 'off',
'@typescript-eslint/method-signature-style': 'off',
'@typescript-eslint/prefer-includes': 'off',
'@typescript-eslint/ban-ts-comment': 'off',
'@typescript-eslint/ban-types': 'off',
'@typescript-eslint/consistent-type-imports': 'off',
'@typescript-eslint/consistent-generic-constructors': 'off',
'@typescript-eslint/no-unnecessary-type-assertion': 'off',
'@typescript-eslint/no-unsafe-argument': 'off',
'@typescript-eslint/unbound-method': 'off',
'@typescript-eslint/member-delimiter-style': ['error', {
multiline: {
delimiter: 'none',
requireLast: true
},
singleline: {
delimiter: 'semi',
requireLast: false
}
}]
},
parserOptions: {
ecmaVersion: 2021,
sourceType: 'module',
project: './tsconfig.json',
tsconfigRootDir: __dirname,
createDefaultProgram: true
},
}
]
}
1 change: 1 addition & 0 deletions packages/runtime/src/CallbackInfo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ export class CallbackInfo {

public getNewTarget (envObject: Env): number {
const thiz = this.thiz
// eslint-disable-next-line @typescript-eslint/prefer-optional-chain
if (thiz == null || thiz.constructor == null) return 0
return thiz instanceof this.fn ? envObject.ensureHandleId(thiz.constructor) : 0
}
Expand Down

0 comments on commit 0660480

Please # to comment.