diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d6dcb14aa6..6a465e9136 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -5,15 +5,15 @@ on: pull_request: jobs: - jshint: - name: JSHint + eslint: + name: eslint runs-on: ubuntu-latest steps: - name: Checkout repository uses: actions/checkout@v4 - - name: Run JSHint - run: sudo npm install -g jshint; make jshint + - name: Run eslint + run: sudo npm install -g eslint; make eslint test: runs-on: ubuntu-latest diff --git a/.jshint.json b/.jshint.json deleted file mode 100644 index ac873d6ae9..0000000000 --- a/.jshint.json +++ /dev/null @@ -1,25 +0,0 @@ -{ - "esversion": 8, - "globalstrict": true, - "sub": true, - "expr": true, - "-W058": true, - "-W080": true, - "-W082": true, - "-W079": true, - "-W117": true, - "-W054": true, - "-W027": true, - "-W040": true, - "-W087": true, - "-W008": true, - "loopfunc": true, - "shadow": true, - "funcscope": true, - "globals": { - "Blob": false, - "alert": false, - "console": false - }, - "browser": true -} diff --git a/Makefile b/Makefile index 5f6b93aa4d..8c8782f747 100644 --- a/Makefile +++ b/Makefile @@ -317,12 +317,12 @@ api-tests: all-debug ./tests/api/floppy-insert-eject.js ./tests/api/serial.js -all-tests: jshint kvm-unit-test qemutests qemutests-release jitpagingtests api-tests nasmtests nasmtests-force-jit tests expect-tests +all-tests: eslint kvm-unit-test qemutests qemutests-release jitpagingtests api-tests nasmtests nasmtests-force-jit tests expect-tests # Skipping: # - devices-test (hangs) -jshint: - jshint --config=./.jshint.json src tests gen lib +eslint: + eslint src tests gen lib examples rustfmt: $(RUST_FILES) cargo fmt --all -- --check --config fn_single_line=true,control_brace_style=ClosingNextLine diff --git a/eslint.config.mjs b/eslint.config.mjs new file mode 100644 index 0000000000..52c9a4b4c2 --- /dev/null +++ b/eslint.config.mjs @@ -0,0 +1,74 @@ +export default [ + { + rules: { + "semi": "error", + //"no-var": "error", + "radix": "error", + "comma-style": ["error", "last"], + //"comma-dangle": ["error", "always-multiline"], + "no-sequences": "error", + //"one-var": ["error", "never"], + "constructor-super": "error", + "for-direction": "error", + "getter-return": "error", + "no-async-promise-executor": "error", + //"no-case-declarations": "error", + "no-class-assign": "error", + "no-compare-neg-zero": "error", + "no-cond-assign": "error", + "no-const-assign": "error", + "no-constant-binary-expression": "error", + //"no-constant-condition": "error", + //"no-control-regex": "error", + //"no-debugger": "error", + "no-delete-var": "error", + "no-dupe-args": "error", + "no-dupe-class-members": "error", + //"no-dupe-else-if": "error", + "no-dupe-keys": "error", + "no-duplicate-case": "error", + //"no-empty": "error", + "no-empty-character-class": "error", + "no-empty-pattern": "error", + "no-empty-static-block": "error", + "no-ex-assign": "error", + "no-extra-boolean-cast": "error", + "no-fallthrough": "error", + "no-func-assign": "error", + "no-global-assign": "error", + "no-import-assign": "error", + "no-invalid-regexp": "error", + "no-irregular-whitespace": "error", + "no-loss-of-precision": "error", + "no-misleading-character-class": "error", + "no-new-native-nonconstructor": "error", + "no-nonoctal-decimal-escape": "error", + "no-obj-calls": "error", + "no-octal": "error", + "no-prototype-builtins": "error", + //"no-redeclare": "error", + "no-regex-spaces": "error", + "no-self-assign": "error", + "no-setter-return": "error", + "no-shadow-restricted-names": "error", + "no-sparse-arrays": "error", + "no-this-before-super": "error", + //"no-undef": "error", + "no-unexpected-multiline": "error", + //"no-unreachable": "error", + "no-unsafe-finally": "error", + "no-unsafe-negation": "error", + "no-unsafe-optional-chaining": "error", + "no-unused-labels": "error", + "no-unused-private-class-members": "error", + //"no-unused-vars": "error", + "no-useless-backreference": "error", + "no-useless-catch": "error", + //"no-useless-escape": "error", + "no-with": "error", + "require-yield": "error", + "use-isnan": "error", + "valid-typeof": "error" + } + } +];