From 0720ddb5549d48576b149826fecb592f4d3eac57 Mon Sep 17 00:00:00 2001 From: Chuck Driesler Date: Sat, 16 Nov 2024 01:01:26 +0000 Subject: [PATCH] idk --- .eslintrc.js | 44 ------------------------ eslint.config.mjs | 68 +++++++++++++++++++++++++++++++++++++ package-lock.json | 20 +++++++++-- package.json | 1 + packages/core/package.json | 2 +- packages/nodes/package.json | 4 +-- 6 files changed, 89 insertions(+), 50 deletions(-) delete mode 100644 .eslintrc.js create mode 100644 eslint.config.mjs diff --git a/.eslintrc.js b/.eslintrc.js deleted file mode 100644 index 16e1bb72a..000000000 --- a/.eslintrc.js +++ /dev/null @@ -1,44 +0,0 @@ -module.exports = { - env: { - node: true, - }, - extends: [ - 'eslint:recommended', - 'plugin:@typescript-eslint/recommended', - 'plugin:jsx-a11y/recommended', - 'plugin:prettier/recommended', - ], - ignorePatterns: ['*.js', '*.json', '*.spec.ts', 'build', 'dist', 'node_modules'], - overrides: [ - { - files: ['*.ts', '*.tsx'], - rules: { - 'no-unused-vars': 'off', - '@typescript-eslint/explicit-module-boundary-types': [0], - '@typescript-eslint/no-unused-vars': [ - 'warn', - { - argsIgnorePattern: '^_', - varsIgnorePattern: '^_', - caughtErrorsIgnorePattern: '^_', - }, - ], - }, - }, - ], - parser: '@typescript-eslint/parser', - parserOptions: { - tsconfigRootDir: __dirname, - project: [ - './tsconfig.eslint.json', - './apps/nodepen-client/tsconfig.json', - './packages/core/tsconfig.json', - './packages/nodes/tsconfig.json', - ], - }, - plugins: ['@typescript-eslint', 'prettier'], - root: true, - rules: { - "prettier/prettier": "error" - } -} diff --git a/eslint.config.mjs b/eslint.config.mjs new file mode 100644 index 000000000..5e30a2359 --- /dev/null +++ b/eslint.config.mjs @@ -0,0 +1,68 @@ +import typescriptEslint from "@typescript-eslint/eslint-plugin"; +import prettier from "eslint-plugin-prettier"; +import globals from "globals"; +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: [ + "**/*.js", + "**/*.json", + "**/*.spec.ts", + "**/build", + "**/dist", + "**/node_modules", + ], + }, + ...compat.extends( + "eslint:recommended", + "plugin:@typescript-eslint/recommended", + "plugin:jsx-a11y/recommended", + "plugin:prettier/recommended", + ), + { + files: ["**/*.ts", "**/*.tsx"], + plugins: { + "@typescript-eslint": typescriptEslint, + prettier, + }, + languageOptions: { + globals: { + ...globals.node, + }, + parser: tsParser, + ecmaVersion: 5, + sourceType: "commonjs", + parserOptions: { + tsconfigRootDir: "D:\\src\\github.com\\nodepen\\nodes", + project: [ + "./apps/nodepen-client/tsconfig.json", + "./packages/core/tsconfig.json", + "./packages/nodes/tsconfig.json", + ], + }, + }, + rules: { + "prettier/prettier": "error", + "no-unused-vars": "off", + "@typescript-eslint/explicit-module-boundary-types": [0], + "@typescript-eslint/no-unused-vars": ["warn", { + argsIgnorePattern: "^_", + varsIgnorePattern: "^_", + caughtErrorsIgnorePattern: "^_", + }], + }, + }, +]; \ No newline at end of file diff --git a/package-lock.json b/package-lock.json index 4960b3bf6..7fa5bff65 100644 --- a/package-lock.json +++ b/package-lock.json @@ -24,6 +24,7 @@ "eslint-config-prettier": "^9.1.0", "eslint-plugin-jsx-a11y": "^6.8.0", "eslint-plugin-prettier": "^5.2.1", + "globals": "^15.12.0", "prettier": "^3.3.3", "ts-jest": "^29.1.4", "tsc-alias": "^1.8.10", @@ -807,6 +808,19 @@ "dev": true, "license": "Python-2.0" }, + "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/eslintrc/node_modules/js-yaml": { "version": "4.1.0", "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.0.tgz", @@ -4931,9 +4945,9 @@ "peer": true }, "node_modules/globals": { - "version": "14.0.0", - "resolved": "https://registry.npmjs.org/globals/-/globals-14.0.0.tgz", - "integrity": "sha512-oahGvuMGQlPw/ivIYBjVSrWAfWLBeku5tpPE2fOPLi+WHffIWbuh2tCjhyQhTBPMf5E9jDEH4FOmTYgYwbKwtQ==", + "version": "15.12.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-15.12.0.tgz", + "integrity": "sha512-1+gLErljJFhbOVyaetcwJiJ4+eLe45S2E7P5UiZ9xGfeq3ATQf5DOv9G7MH3gGbKQLkzmNh2DxfZwLdw+j6oTQ==", "dev": true, "license": "MIT", "engines": { diff --git a/package.json b/package.json index 70e71fea2..01608690b 100644 --- a/package.json +++ b/package.json @@ -33,6 +33,7 @@ "eslint-config-prettier": "^9.1.0", "eslint-plugin-jsx-a11y": "^6.8.0", "eslint-plugin-prettier": "^5.2.1", + "globals": "^15.12.0", "prettier": "^3.3.3", "ts-jest": "^29.1.4", "tsc-alias": "^1.8.10", diff --git a/packages/core/package.json b/packages/core/package.json index 8eaa4eedc..9b4d6ccc7 100644 --- a/packages/core/package.json +++ b/packages/core/package.json @@ -15,7 +15,7 @@ "scripts": { "build": "tsc", "dev": "tsc -w --preserveWatchOutput", - "lint": "eslint --ext .ts,.tsx .", + "lint": "eslint .", "test": "echo \"ok\"" } } diff --git a/packages/nodes/package.json b/packages/nodes/package.json index 2dee60d63..84dc0081b 100644 --- a/packages/nodes/package.json +++ b/packages/nodes/package.json @@ -18,8 +18,8 @@ "build": "tsc", "postbuild": "tsc-alias", "dev": "concurrently \"tsc-watch --noClear --onSuccess \\\"npm run prebuild\\\"\" \"tsc-alias -w\"", - "lint": "eslint --ext .ts,.tsx .", - "lint:fix": "eslint --fix --ext .ts,.tsx .", + "lint": "eslint .", + "lint:fix": "eslint --fix .", "test": "jest" }, "dependencies": {