diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index b3cbd214..841afd50 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -1,30 +1,27 @@ // For format details, see https://aka.ms/devcontainer.json. For config options, see the README at: // https://github.com/microsoft/vscode-dev-containers/tree/v0.209.6/containers/javascript-node { - "name": "Node.js", - "build": { - "dockerfile": "Dockerfile", - // Update 'VARIANT' to pick a Node version: 16, 14, 12. - // Append -bullseye or -buster to pin to an OS version. - // Use -bullseye variants on local arm64/Apple Silicon. - "args": { "VARIANT": "16-bullseye" } - }, + "name": "Node.js", + "build": { + "dockerfile": "Dockerfile", + // Update 'VARIANT' to pick a Node version: 16, 14, 12. + // Append -bullseye or -buster to pin to an OS version. + // Use -bullseye variants on local arm64/Apple Silicon. + "args": { "VARIANT": "16-bullseye" } + }, - // Set *default* container specific settings.json values on container create. - "settings": {}, + // Set *default* container specific settings.json values on container create. + "settings": {}, - // Add the IDs of extensions you want installed when the container is created. - "extensions": [ - "dbaeumer.vscode-eslint", - "svelte.svelte-vscode" - ], + // Add the IDs of extensions you want installed when the container is created. + "extensions": ["dbaeumer.vscode-eslint", "svelte.svelte-vscode"], - // Use 'forwardPorts' to make a list of ports inside the container available locally. - // "forwardPorts": [], + // Use 'forwardPorts' to make a list of ports inside the container available locally. + // "forwardPorts": [], - // Use 'postCreateCommand' to run commands after the container is created. - "postCreateCommand": "pnpm install", + // Use 'postCreateCommand' to run commands after the container is created. + "postCreateCommand": "pnpm install", - // Comment out connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root. - "remoteUser": "node" + // Comment out connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root. + "remoteUser": "node" } diff --git a/.eslintignore b/.eslintignore deleted file mode 100644 index db0e0af6..00000000 --- a/.eslintignore +++ /dev/null @@ -1,18 +0,0 @@ -/.nyc_output -/coverage -/lib -/node_modules -/tests/fixtures/**/*.json -/tests/fixtures/**/*.svelte -/tests/fixtures/**/*.js -/tests/fixtures/**/*.ts -/explorer/dist -/explorer/node_modules -/explorer-v2/build -/explorer-v2/build -/explorer-v2/build-system/shim/svelte-eslint-parser.* -/explorer-v2/build-system/shim/eslint-scope.* -/explorer-v2/build-system/shim/eslint.* -/explorer-v2/build-system/shim/svelte/* -!/.vscode -!/.github diff --git a/.eslintrc-for-playground.js b/.eslintrc-for-playground.js deleted file mode 100644 index 856cc37f..00000000 --- a/.eslintrc-for-playground.js +++ /dev/null @@ -1,16 +0,0 @@ -"use strict" - -module.exports = { - extends: [ - require.resolve("./.eslintrc.js"), - ], - overrides: [ - { - files: ["*.svelte"], - parser: require.resolve("."), - rules: { - "prettier/prettier": "off" - } - }, - ], -} diff --git a/.eslintrc.js b/.eslintrc.js deleted file mode 100644 index c6e94308..00000000 --- a/.eslintrc.js +++ /dev/null @@ -1,88 +0,0 @@ -"use strict"; - -// const version = require("./package.json").version - -module.exports = { - parserOptions: { - sourceType: "script", - ecmaVersion: "latest", - }, - extends: [ - "plugin:@ota-meshi/recommended", - "plugin:@ota-meshi/+node", - "plugin:@ota-meshi/+typescript", - "plugin:@ota-meshi/+prettier", - "plugin:@ota-meshi/+package-json", - "plugin:@ota-meshi/+json", - "plugin:@ota-meshi/+yaml", - ], - rules: { - "no-lonely-if": "off", - "no-shadow": "off", - "no-warning-comments": "warn", - "require-jsdoc": "off", - complexity: "off", - "prettier/prettier": [ - "error", - {}, - { - usePrettierrc: true, - }, - ], - }, - overrides: [ - { - files: ["*.ts"], - parser: "@typescript-eslint/parser", - parserOptions: { - sourceType: "module", - project: "./tsconfig.json", - }, - rules: { - "@typescript-eslint/naming-convention": [ - "error", - { - selector: "default", - format: ["camelCase"], - leadingUnderscore: "allow", - trailingUnderscore: "allow", - }, - { - selector: "variable", - format: ["camelCase", "UPPER_CASE"], - leadingUnderscore: "allow", - trailingUnderscore: "allow", - }, - { - selector: "typeLike", - format: ["PascalCase"], - }, - { - selector: "property", - format: null, - }, - { - selector: "method", - format: null, - }, - { - selector: "import", - format: ["camelCase", "PascalCase", "UPPER_CASE"], - }, - ], - "@typescript-eslint/no-non-null-assertion": "off", - "@typescript-eslint/no-use-before-define": "off", - "@typescript-eslint/no-explicit-any": "off", - "no-implicit-globals": "off", - "no-void": ["error", { allowAsStatement: true }], - }, - }, - { - files: ["scripts/**/*.ts", "tests/**/*.ts"], - rules: { - "no-console": "off", - "require-jsdoc": "off", - }, - }, - ], -}; diff --git a/.github/workflows/NodeCI.yml b/.github/workflows/NodeCI.yml index 65a7e68e..22eff40d 100644 --- a/.github/workflows/NodeCI.yml +++ b/.github/workflows/NodeCI.yml @@ -77,47 +77,7 @@ jobs: node-version: ${{ matrix.node-version }} - name: Install Svelte v3 run: |+ - pnpm install -D svelte@3 @typescript-eslint/parser@5 @typescript-eslint/eslint-plugin@5 - rm -rf node_modules - - name: Install Packages - run: pnpm install - - name: Test - run: pnpm run test - test-for-ts-eslint-v5: - runs-on: ubuntu-latest - strategy: - matrix: - node-version: [18.x] - steps: - - uses: actions/checkout@v4 - - uses: pnpm/action-setup@v2 - - name: Use Node.js ${{ matrix.node-version }} - uses: actions/setup-node@v4 - with: - node-version: ${{ matrix.node-version }} - - name: Install @typescript-eslint v5 - run: |+ - pnpm install -D @typescript-eslint/parser@5 @typescript-eslint/eslint-plugin@5 - rm -rf node_modules - - name: Install Packages - run: pnpm install - - name: Test - run: pnpm run test - test-for-eslint-v7: - runs-on: ubuntu-latest - strategy: - matrix: - node-version: [18.x] - steps: - - uses: actions/checkout@v4 - - uses: pnpm/action-setup@v2 - - name: Use Node.js ${{ matrix.node-version }} - uses: actions/setup-node@v4 - with: - node-version: ${{ matrix.node-version }} - - name: Install eslint v7 - run: |+ - pnpm install -D eslint@7 svelte@3 @typescript-eslint/parser@5 @typescript-eslint/eslint-plugin@5 + pnpm install -D svelte@3 rm -rf node_modules - name: Install Packages run: pnpm install diff --git a/.vscode/settings.json b/.vscode/settings.json index b26364e7..9c6a3db4 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -15,5 +15,5 @@ "editor.codeActionsOnSave": { "source.fixAll.eslint": "explicit" }, - "vetur.validation.template": false + "eslint.enable": true } diff --git a/benchmark/index.ts b/benchmark/index.ts index e74b296c..46b54fcd 100644 --- a/benchmark/index.ts +++ b/benchmark/index.ts @@ -1,4 +1,4 @@ -// eslint-disable-next-line eslint-comments/disable-enable-pair -- ignore +// eslint-disable-next-line @eslint-community/eslint-comments/disable-enable-pair -- ignore /* eslint-disable no-console -- ignore */ import * as Benchmark from "benchmark"; import fs from "fs"; diff --git a/eslint.config.mjs b/eslint.config.mjs new file mode 100644 index 00000000..937ba332 --- /dev/null +++ b/eslint.config.mjs @@ -0,0 +1,168 @@ +import * as myPlugin from "@ota-meshi/eslint-plugin"; +import globals from "globals"; + +export default [ + { + ignores: [ + ".nyc_output", + "coverage", + "lib", + "node_modules", + "tests/fixtures/**/*.json", + "tests/fixtures/**/*.svelte", + "tests/fixtures/**/*.js", + "tests/fixtures/**/*.ts", + "!tests/fixtures/integrations/**/*-setup.ts", + "explorer/dist", + "explorer/node_modules", + "explorer-v2/build", + "explorer-v2/build", + "explorer-v2/build-system/shim/svelte-eslint-parser.*", + "explorer-v2/build-system/shim/eslint-scope.*", + "explorer-v2/build-system/shim/eslint.*", + "explorer-v2/build-system/shim/svelte/*", + "!.vscode", + "!.github", + "explorer-v2/.svelte-kit", + ".changeset/pre.json", + ], + }, + ...myPlugin.config({ + node: true, + ts: true, + json: true, + packageJson: true, + yaml: true, + prettier: true, + }), + { + languageOptions: { + sourceType: "module", + }, + + rules: { + "no-lonely-if": "off", + "no-shadow": "off", + "@typescript-eslint/no-shadow": "off", + "no-warning-comments": "warn", + "jsdoc/require-jsdoc": "off", + complexity: "off", + + "prettier/prettier": [ + "error", + {}, + { + usePrettierrc: true, + }, + ], + }, + }, + { + files: ["**/*.ts"], + + languageOptions: { + parserOptions: { + project: "./tsconfig.json", + }, + }, + + rules: { + "@typescript-eslint/naming-convention": [ + "error", + { + selector: "default", + format: ["camelCase"], + leadingUnderscore: "allow", + trailingUnderscore: "allow", + }, + { + selector: "variable", + format: ["camelCase", "UPPER_CASE"], + leadingUnderscore: "allow", + trailingUnderscore: "allow", + }, + { + selector: "typeLike", + format: ["PascalCase"], + }, + { + selector: "property", + format: null, + }, + { + selector: "method", + format: null, + }, + { + selector: "import", + format: ["camelCase", "PascalCase", "UPPER_CASE"], + }, + ], + + "@typescript-eslint/no-non-null-assertion": "off", + "@typescript-eslint/no-use-before-define": "off", + "@typescript-eslint/no-explicit-any": "off", + "no-implicit-globals": "off", + + "no-void": [ + "error", + { + allowAsStatement: true, + }, + ], + }, + }, + { + files: ["scripts/**/*.ts", "tests/**/*.ts"], + + rules: { + "no-console": "off", + "jsdoc/require-jsdoc": "off", + }, + }, + + ...myPlugin + .config({ + prettier: true, + svelte: true, + }) + .map(async (config) => ({ + ...(await config), + files: ["explorer-v2/**/*.svelte"], + })), + { + files: ["explorer-v2/**/*.{svelte,js}"], + languageOptions: { + globals: { + ...globals.browser, + }, + }, + rules: { + "eslint-comments/no-unused-disable": "off", + "n/no-missing-import": "off", + "n/no-unpublished-require": "off", + "n/no-unpublished-import": "off", + "n/no-unsupported-features/es-syntax": "off", + "n/no-unsupported-features/node-builtins": "off", + "require-jsdoc": "off", + "n/file-extension-in-import": "off", + + "prettier/prettier": [ + "error", + {}, + { + usePrettierrc: true, + }, + ], + + "no-shadow": "off", + camelcase: "off", + }, + }, + { + files: ["**/*.d.ts"], + rules: { + "spaced-comment": "off", + }, + }, +]; diff --git a/explorer-v2/.eslintrc.cjs b/explorer-v2/.eslintrc.cjs deleted file mode 100644 index 25cf2865..00000000 --- a/explorer-v2/.eslintrc.cjs +++ /dev/null @@ -1,46 +0,0 @@ -module.exports = { - root: true, - extends: [ - 'plugin:@ota-meshi/recommended', - 'plugin:@ota-meshi/+node', - 'plugin:@ota-meshi/+json', - 'plugin:@ota-meshi/+prettier', - 'plugin:svelte/recommended' - ], - parserOptions: { - sourceType: 'module', - ecmaVersion: 2020 - }, - env: { - browser: true, - es2017: true, - node: true - }, - rules: { - 'eslint-comments/no-unused-disable': 'off', - 'n/no-missing-import': 'off', - 'n/no-unpublished-require': 'off', - 'n/no-unpublished-import': 'off', - 'n/no-unsupported-features/es-syntax': 'off', - 'n/no-unsupported-features/node-builtins': 'off', - 'require-jsdoc': 'off', - 'n/file-extension-in-import': 'off', - 'prettier/prettier': [ - 'error', - {}, - { - usePrettierrc: true - } - ], - 'no-shadow': 'off', - camelcase: 'off' - }, - overrides: [ - { - files: ['*.d.ts'], - rules: { - 'spaced-comment': 'off' - } - } - ] -}; diff --git a/explorer-v2/src/lib/AstExplorer.svelte b/explorer-v2/src/lib/AstExplorer.svelte index 81c73042..66ff7746 100644 --- a/explorer-v2/src/lib/AstExplorer.svelte +++ b/explorer-v2/src/lib/AstExplorer.svelte @@ -1,5 +1,5 @@ -