diff --git a/.eslintignore b/.eslintignore deleted file mode 100644 index 00d5cdc..0000000 --- a/.eslintignore +++ /dev/null @@ -1,3 +0,0 @@ -node_modules -dist -.vscode \ No newline at end of file diff --git a/.eslintrc.js b/.eslintrc.js deleted file mode 100644 index 77c4b98..0000000 --- a/.eslintrc.js +++ /dev/null @@ -1,47 +0,0 @@ -module.exports = { - extends: [ - 'eslint:recommended', - 'plugin:@typescript-eslint/eslint-recommended', - 'plugin:@typescript-eslint/recommended', - 'plugin:prettier/recommended', - ], - parser: '@typescript-eslint/parser', - plugins: ['@typescript-eslint', 'simple-import-sort'], - root: true, - rules: { - camelcase: 'off', - 'no-unused-vars': 'off', - 'sort-imports': 'off', - - 'prettier/prettier': [ - 'error', - { - endOfLine: 'auto', - }, - ], - 'simple-import-sort/imports': 'error', - '@typescript-eslint/naming-convention': [ - 'error', - { - selector: 'variable', - format: ['camelCase', 'PascalCase', 'UPPER_CASE'], - custom: { - regex: '^opt_', - match: false, - }, - }, - ], - '@typescript-eslint/explicit-function-return-type': 'off', - '@typescript-eslint/no-empty-function': 'off', - '@typescript-eslint/no-explicit-any': 'off', - '@typescript-eslint/no-unused-vars': [ - 'error', - { - argsIgnorePattern: '^_', - }, - ], - - // TODO: Resolve latest lint warnings - '@typescript-eslint/explicit-module-boundary-types': 'off', - }, -}; diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 6764e70..6ba17cb 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -13,7 +13,7 @@ jobs: strategy: matrix: - node-version: [16.x, 18.x, 20.x, latest] + node-version: [18.x, 20.x, latest] steps: - uses: actions/checkout@v3 diff --git a/README.md b/README.md index be38688..ee469ad 100644 --- a/README.md +++ b/README.md @@ -130,6 +130,7 @@ npm install To build the source code and watch changes, run: ```sh +npm run build:dev npm start ``` diff --git a/eslint.config.mjs b/eslint.config.mjs new file mode 100644 index 0000000..6abf6a2 --- /dev/null +++ b/eslint.config.mjs @@ -0,0 +1,70 @@ +import typescriptEslint from "@typescript-eslint/eslint-plugin"; +import simpleImportSort from "eslint-plugin-simple-import-sort"; +import tsParser from "@typescript-eslint/parser"; +import path from "node:path"; +import { fileURLToPath } from "node:url"; +import js from "@eslint/js"; +import { FlatCompat } from "@eslint/eslintrc"; + +const __filename = fileURLToPath(import.meta.url); +const __dirname = path.dirname(__filename); +const compat = new FlatCompat({ + baseDirectory: __dirname, + recommendedConfig: js.configs.recommended, + allConfig: js.configs.all +}); + +export default [{ + ignores: ["**/node_modules", "**/dist", "**/.vscode", "**/coverage", "**/nyc-output"], +}, ...compat.extends( + "eslint:recommended", + "plugin:@typescript-eslint/eslint-recommended", + "plugin:@typescript-eslint/recommended", + "plugin:prettier/recommended", +).map(config => ({ + ...config, + files: ["**/*.ts", "**/*.tsx"], +})), { + files: ["**/*.ts", "**/*.tsx"], + + plugins: { + "@typescript-eslint": typescriptEslint, + "simple-import-sort": simpleImportSort, + }, + + languageOptions: { + parser: tsParser, + }, + + rules: { + camelcase: "off", + "no-unused-vars": "off", + "sort-imports": "off", + + "prettier/prettier": ["error", { + endOfLine: "auto", + }], + + "simple-import-sort/imports": "error", + + "@typescript-eslint/naming-convention": ["error", { + selector: "variable", + format: ["camelCase", "PascalCase", "UPPER_CASE"], + + custom: { + regex: "^opt_", + match: false, + }, + }], + + "@typescript-eslint/explicit-function-return-type": "off", + "@typescript-eslint/no-empty-function": "off", + "@typescript-eslint/no-explicit-any": "off", + + "@typescript-eslint/no-unused-vars": ["error", { + argsIgnorePattern: "^_", + }], + + "@typescript-eslint/explicit-module-boundary-types": "off", + }, +}]; \ No newline at end of file diff --git a/package.json b/package.json index a4025a3..f23336d 100644 --- a/package.json +++ b/package.json @@ -19,7 +19,7 @@ "prepare": "run-s clean build", "prepublishOnly": "npm test", "start": "run-p watch server", - "test": "eslint --ext .ts \"src/**/*.ts\"", + "test": "eslint \"src/**/*.ts\"", "assets": "run-s clean build assets:version assets:zip", "assets:version": "node scripts/assets-append-version.js", "assets:zip": "zip -x '*types*' -j -r $(node scripts/dist-name.js)-$(cat package.json | npx json version).zip dist", @@ -30,7 +30,7 @@ "build:prod": "rollup --config rollup.config.js --environment BUILD:production", "format": "run-p format:*", "format:scss": "prettier --parser scss --write \"src/sass/**/*.scss\"", - "format:ts": "eslint --ext .ts --fix \"src/**/*.ts\"", + "format:ts": "eslint --fix \"src/**/*.ts\"", "server": "http-server -c-1 -o /test/browser.html", "watch": "run-p watch:*", "watch:sass": "onchange --initial --kill \"src/sass/**/*.scss\" -- npm run build:dev", @@ -39,29 +39,28 @@ "devDependencies": { "@rollup/plugin-alias": "^5.1.0", "@rollup/plugin-node-resolve": "^15.2.3", - "@rollup/plugin-replace": "^5.0.5", - "@rollup/plugin-typescript": "^11.1.5", + "@rollup/plugin-replace": "^5.0.7", + "@rollup/plugin-typescript": "^11.1.6", "@tweakpane/core": "^2.0.1", - "@typescript-eslint/eslint-plugin": "^6.14.0", - "@typescript-eslint/parser": "6.20.0", + "@typescript-eslint/eslint-plugin": "^8.5.0", + "@typescript-eslint/parser": "^8.5.0", "autoprefixer": "^10.2.4", - "eslint": "^8.46.0", + "eslint": "^9.10.0", "eslint-config-prettier": "^9.1.0", - "eslint-plugin-prettier": "^5.0.1", - "eslint-plugin-simple-import-sort": "^12.0.0", + "eslint-plugin-prettier": "^5.2.1", + "eslint-plugin-simple-import-sort": "^12.1.1", "http-server": "^14.1.1", "npm-run-all": "^4.1.5", "onchange": "^7.1.0", - "postcss": "^8.2.6", - "prettier": "^3.1.1", - "release-it": "^17.0.0", + "postcss": "^8.4.45", + "prettier": "^3.3.3", + "release-it": "^17.6.0", "rimraf": "^6.0.1", "rollup": "^2.39.1", - "rollup-plugin-cleanup": "^3.2.1", + "rollup-plugin-cleanup": "3.2.1", "rollup-plugin-terser": "^7.0.2", - "sass": "^1.49.9", - "tweakpane": "^4.0.0", - "typescript": "^5.3.3" + "sass": "^1.78.0", + "typescript": "^5.6.2" }, "peerDependencies": { "tweakpane": "^4.0.0"