diff --git a/.eslintrc.js b/.eslintrc.js deleted file mode 100644 index 2f7aa75..0000000 --- a/.eslintrc.js +++ /dev/null @@ -1,30 +0,0 @@ -module.exports = { - env: { - browser: true, - es2017: true, - greasemonkey: true, - jquery: true, - }, - extends: ['eslint:recommended', 'plugin:prettier/recommended'], - globals: { - LOGGER: true, - MBImportStyle: true, - MBImport: true, - MBLinks: true, - MBSearchItStyle: true, - }, - rules: { - 'prettier/prettier': 'error', - 'prefer-template': 'error', - 'no-console': 'off', - 'no-inner-declarations': 'warn', - 'no-global-assign': 'warn', - 'no-redeclare': 'warn', - 'no-self-assign': 'warn', - 'no-undef': 'warn', - 'no-useless-concat': 'warn', - 'no-useless-escape': 'warn', - 'no-unused-vars': 'warn', - 'no-var': 'warn', - }, -}; diff --git a/.github/workflows/checks.yml b/.github/workflows/checks.yml index 7975a94..01a9005 100644 --- a/.github/workflows/checks.yml +++ b/.github/workflows/checks.yml @@ -9,11 +9,11 @@ jobs: - uses: actions/checkout@v4 - uses: actions/setup-node@v4.4.0 with: - node-version: 20 + node-version: 20 - name: 'Install dependencies' run: npm install - name: 'Run linter' - run: ESLINT_USE_FLAT_CONFIG=false npm run lint + run: npm run lint auto-merge: name: 'dependabot-auto-merge' needs: linter diff --git a/eslint.config.js b/eslint.config.js new file mode 100644 index 0000000..e6d24e2 --- /dev/null +++ b/eslint.config.js @@ -0,0 +1,38 @@ +import { defineConfig } from 'eslint/config'; +import globals from 'globals'; +import js from '@eslint/js'; +import prettier from 'eslint-plugin-prettier/recommended'; + +export default defineConfig([ + js.configs.recommended, + prettier, + { + languageOptions: { + globals: { + ...globals.browser, + ...globals.greasemonkey, + ...globals.jquery, + LOGGER: true, + MBImportStyle: true, + MBImport: true, + MBLinks: true, + MBSearchItStyle: true, + }, + }, + + rules: { + 'prettier/prettier': 'error', + 'prefer-template': 'error', + 'no-console': 'off', + 'no-inner-declarations': 'warn', + 'no-global-assign': 'warn', + 'no-redeclare': 'warn', + 'no-self-assign': 'warn', + 'no-undef': 'warn', + 'no-useless-concat': 'warn', + 'no-useless-escape': 'warn', + 'no-unused-vars': 'warn', + 'no-var': 'warn', + }, + }, +]); diff --git a/package-lock.json b/package-lock.json index 59cde9a..e5a3e41 100644 --- a/package-lock.json +++ b/package-lock.json @@ -10,10 +10,11 @@ "license": "SEE LICENSE IN individual userscripts", "devDependencies": { "@eslint-community/eslint-utils": "^4.6.1", + "@eslint/js": "^9.25.1", "eslint": "^9.25.1", - "eslint-config-prettier": "^10.1.2", "eslint-plugin-import": "^2.31.0", "eslint-plugin-prettier": "^5.2.6", + "globals": "^16.0.0", "prettier": "^3.5.3" } }, @@ -84,6 +85,7 @@ "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-3.3.1.tgz", "integrity": "sha512-gtF186CXhIl1p4pJNGZw8Yc6RlshoePRvE0X91oPGb3vZ8pM3qOS9W9NGPat9LziaBV7XrJWGylNQXkGcnM3IQ==", "dev": true, + "license": "MIT", "dependencies": { "ajv": "^6.12.4", "debug": "^4.3.2", @@ -102,6 +104,19 @@ "url": "https://opencollective.com/eslint" } }, + "node_modules/@eslint/eslintrc/node_modules/globals": { + "version": "14.0.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-14.0.0.tgz", + "integrity": "sha512-oahGvuMGQlPw/ivIYBjVSrWAfWLBeku5tpPE2fOPLi+WHffIWbuh2tCjhyQhTBPMf5E9jDEH4FOmTYgYwbKwtQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/@eslint/js": { "version": "9.25.1", "resolved": "https://registry.npmjs.org/@eslint/js/-/js-9.25.1.tgz", @@ -856,6 +871,8 @@ "resolved": "https://registry.npmjs.org/eslint-config-prettier/-/eslint-config-prettier-10.1.2.tgz", "integrity": "sha512-Epgp/EofAUeEpIdZkW60MHKvPyru1ruQJxPL+WIycnaPApuseK0Zpkrh/FwL9oIpQvIhJwV7ptOy0DWUjTlCiA==", "dev": true, + "optional": true, + "peer": true, "bin": { "eslint-config-prettier": "bin/cli.js" }, @@ -1269,10 +1286,11 @@ } }, "node_modules/globals": { - "version": "14.0.0", - "resolved": "https://registry.npmjs.org/globals/-/globals-14.0.0.tgz", - "integrity": "sha512-oahGvuMGQlPw/ivIYBjVSrWAfWLBeku5tpPE2fOPLi+WHffIWbuh2tCjhyQhTBPMf5E9jDEH4FOmTYgYwbKwtQ==", + "version": "16.0.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-16.0.0.tgz", + "integrity": "sha512-iInW14XItCXET01CQFqudPOWP2jYMl7T+QRQT+UNcR/iQncN/F0UNpgd76iFkBPgNQb4+X3LV9tLJYzwh+Gl3A==", "dev": true, + "license": "MIT", "engines": { "node": ">=18" }, diff --git a/package.json b/package.json index 919f454..843a2a0 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "musicbrainz-userscripts", "version": "1.0.0", "description": "Collection of userscripts for MusicBrainz", - "main": "index.js", + "type": "module", "directories": { "lib": "lib" }, @@ -31,10 +31,11 @@ "homepage": "https://github.com/murdos/musicbrainz-userscripts#readme", "devDependencies": { "@eslint-community/eslint-utils": "^4.6.1", + "@eslint/js": "^9.25.1", "eslint": "^9.25.1", - "eslint-config-prettier": "^10.1.2", "eslint-plugin-import": "^2.31.0", "eslint-plugin-prettier": "^5.2.6", + "globals": "^16.0.0", "prettier": "^3.5.3" } }