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 @@
-
+
- // 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-useless-escape -- ignore */
import MonacoEditor from './MonacoEditor.svelte';
import * as svelteEslintParser from 'svelte-eslint-parser';
@@ -52,7 +52,7 @@
refresh(code);
}
}
- // eslint-disable-next-line no-use-before-define -- false positive
+
$: serializedString = (() => {
const serializeCode = DEFAULT_CODE === code ? undefined : code;
return serializeState({
@@ -89,7 +89,6 @@
parser: tsParser
})._virtualScriptCode;
} catch (e) {
- // eslint-disable-next-line no-console -- Demo
console.error(e);
virtualScriptCode = `message: ${e.message}`;
time = `${Date.now() - start}ms`;
diff --git a/explorer-v2/src/lib/scripts/state/deserialize.js b/explorer-v2/src/lib/scripts/state/deserialize.js
index eae07f08..585c35d5 100644
--- a/explorer-v2/src/lib/scripts/state/deserialize.js
+++ b/explorer-v2/src/lib/scripts/state/deserialize.js
@@ -18,7 +18,7 @@ export function deserializeState(serializedString) {
try {
const compressedString = window.atob(serializedString);
const uint8Arr = pako.inflate(Uint8Array.from(compressedString, (c) => c.charCodeAt(0)));
- // eslint-disable-next-line n/no-unsupported-features/node-builtins -- ignore
+
const jsonText = new TextDecoder().decode(uint8Arr);
const json = JSON.parse(jsonText);
diff --git a/explorer-v2/src/lib/scripts/state/serialize.js b/explorer-v2/src/lib/scripts/state/serialize.js
index 58cbedf5..bb77344d 100644
--- a/explorer-v2/src/lib/scripts/state/serialize.js
+++ b/explorer-v2/src/lib/scripts/state/serialize.js
@@ -25,7 +25,7 @@ export function serializeState(state) {
rules: state.rules ? getEnabledRules(state.rules) : undefined
};
const jsonString = JSON.stringify(saveData);
- // eslint-disable-next-line n/no-unsupported-features/node-builtins -- ignore
+
const uint8Arr = new TextEncoder().encode(jsonString);
const compressedString = String.fromCharCode(...pako.deflate(uint8Arr));
const base64 =
diff --git a/package.json b/package.json
index 4b9d96f2..a2cf3f8a 100644
--- a/package.json
+++ b/package.json
@@ -34,7 +34,7 @@
"cover": "nyc --reporter=lcov pnpm run test",
"debug": "pnpm run mocha \"tests/src/**/*.ts\" --reporter dot --timeout 60000",
"eslint-fix": "pnpm run lint --fix",
- "lint": "eslint . --ext .js,.ts,.json,.yaml,.yml,.svelte",
+ "lint": "eslint .",
"mocha": "pnpm run ts ./node_modules/mocha/bin/mocha.js",
"prebuild": "pnpm run clean",
"prerelease": "pnpm run clean && pnpm run build",
@@ -63,51 +63,54 @@
},
"devDependencies": {
"@changesets/changelog-github": "^0.5.0",
- "@changesets/cli": "^2.27.9",
- "@changesets/get-release-plan": "^4.0.4",
- "@ota-meshi/eslint-plugin": "^0.15.3",
+ "@changesets/cli": "^2.27.10",
+ "@changesets/get-release-plan": "^4.0.5",
+ "@ota-meshi/eslint-plugin": "^0.17.6",
"@types/benchmark": "^2.1.5",
"@types/chai": "^4.3.20",
"@types/eslint": "^9.6.1",
"@types/eslint-scope": "^3.7.7",
- "@types/eslint-visitor-keys": "^3.3.0",
+ "@types/eslint-visitor-keys": "^3.3.2",
"@types/estree": "^1.0.6",
- "@types/mocha": "^10.0.9",
- "@types/node": "^22.0.0",
+ "@types/mocha": "^10.0.10",
+ "@types/node": "^22.10.1",
"@types/semver": "^7.5.8",
- "@typescript-eslint/eslint-plugin": "^7.18.0",
- "@typescript-eslint/parser": "~7.18.0",
- "@typescript-eslint/types": "~7.18.0",
+ "@typescript-eslint/eslint-plugin": "^8.16.0",
+ "@typescript-eslint/parser": "~8.16.0",
+ "@typescript-eslint/types": "~8.16.0",
"benchmark": "^2.1.4",
"chai": "^4.5.0",
"env-cmd": "^10.1.0",
"esbuild": "^0.24.0",
"esbuild-register": "^3.6.0",
- "eslint": "^8.57.1",
+ "eslint": "~9.16.0",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-eslint-comments": "^3.2.0",
- "eslint-plugin-json-schema-validator": "^5.1.3",
- "eslint-plugin-jsonc": "^2.16.0",
- "eslint-plugin-n": "^17.11.1",
+ "eslint-plugin-jsdoc": "^50.6.0",
+ "eslint-plugin-json-schema-validator": "^5.2.0",
+ "eslint-plugin-jsonc": "^2.18.2",
+ "eslint-plugin-n": "^17.14.0",
"eslint-plugin-node-dependencies": "^0.12.0",
"eslint-plugin-prettier": "^5.2.1",
- "eslint-plugin-regexp": "^2.6.0",
- "eslint-plugin-svelte": "^2.44.1",
- "eslint-plugin-yml": "^1.14.0",
+ "eslint-plugin-regexp": "^2.7.0",
+ "eslint-plugin-svelte": "^2.46.1",
+ "eslint-plugin-yml": "^1.15.0",
"estree-walker": "^3.0.3",
+ "globals": "^15.12.0",
"locate-character": "^3.0.0",
- "magic-string": "^0.30.12",
- "mocha": "^10.7.3",
+ "magic-string": "^0.30.14",
+ "mocha": "^10.8.2",
"mocha-chai-jest-snapshot": "^1.1.6",
"nyc": "^17.1.0",
- "prettier": "~3.4.0",
+ "prettier": "~3.4.1",
"prettier-plugin-pkg": "^0.18.1",
- "prettier-plugin-svelte": "^3.2.7",
+ "prettier-plugin-svelte": "^3.3.2",
"rimraf": "^6.0.1",
"semver": "^7.6.3",
- "svelte": "^5.0.0",
- "svelte2tsx": "^0.7.22",
- "typescript": "~5.7.0",
+ "svelte": "^5.2.11",
+ "svelte2tsx": "^0.7.28",
+ "typescript": "~5.7.2",
+ "typescript-eslint": "^8.16.0",
"typescript-eslint-parser-for-extra-files": "^0.7.0"
},
"publishConfig": {
diff --git a/src/parser/converts/root.ts b/src/parser/converts/root.ts
index 54cbe964..8253715a 100644
--- a/src/parser/converts/root.ts
+++ b/src/parser/converts/root.ts
@@ -291,18 +291,18 @@ function convertGenericsAttribute(script: SvelteScriptElement, ctx: Context) {
generics.type = "SvelteGenericsDirective";
generics.params = [];
- result.ast.tokens!.shift(); // void
- result.ast.tokens!.shift(); // function
- result.ast.tokens!.shift(); // <
- result.ast.tokens!.pop(); // }
- result.ast.tokens!.pop(); // {
- result.ast.tokens!.pop(); // )
- result.ast.tokens!.pop(); // (
- result.ast.tokens!.pop(); // >
+ result.ast.tokens.shift(); // void
+ result.ast.tokens.shift(); // function
+ result.ast.tokens.shift(); // <
+ result.ast.tokens.pop(); // }
+ result.ast.tokens.pop(); // {
+ result.ast.tokens.pop(); // )
+ result.ast.tokens.pop(); // (
+ result.ast.tokens.pop(); // >
fixLocations(
result.ast as any,
- result.ast.tokens! as any,
- result.ast.comments! as any,
+ result.ast.tokens as any,
+ result.ast.comments as any,
value.range[0] - 14,
result.visitorKeys as any,
ctx,
@@ -318,7 +318,7 @@ function convertGenericsAttribute(script: SvelteScriptElement, ctx: Context) {
// Replace tokens
for (const tokensKey of ["tokens", "comments"] as const) {
- for (const token of result.ast[tokensKey]!) {
+ for (const token of result.ast[tokensKey]) {
if (
params.every(
(param) =>
diff --git a/src/parser/typescript/analyze/index.ts b/src/parser/typescript/analyze/index.ts
index 88a617bd..09c014f9 100644
--- a/src/parser/typescript/analyze/index.ts
+++ b/src/parser/typescript/analyze/index.ts
@@ -511,7 +511,7 @@ function* analyzeReactiveScopes(
node,
left,
expression,
- result.ast.tokens!,
+ result.ast.tokens,
ctx,
),
};
@@ -807,7 +807,7 @@ function transformForDeclareReactiveVar(
// Restore tokens
addElementsToSortedArray(
- program.tokens!,
+ program.tokens,
[...openParens, ...closeParens],
(a, b) => a.range[0] - b.range[0],
);
diff --git a/tests/fixtures/integrations/parser-object-tests/ts-multiple-parser-setup.ts b/tests/fixtures/integrations/parser-object-tests/ts-multiple-parser-setup.ts
index 4d22003f..e044a48c 100644
--- a/tests/fixtures/integrations/parser-object-tests/ts-multiple-parser-setup.ts
+++ b/tests/fixtures/integrations/parser-object-tests/ts-multiple-parser-setup.ts
@@ -1,14 +1,18 @@
-/* eslint eslint-comments/require-description: 0, @typescript-eslint/explicit-module-boundary-types: 0 */
import { generateParserOptions } from "../../../src/parser/test-utils";
import * as ts from "@typescript-eslint/parser";
+import globals from "globals";
+import * as parser from "../../../../src";
+import type { Linter } from "eslint";
-export function getConfig() {
+export function getConfig(): Linter.Config {
return {
- parser: "svelte-eslint-parser",
- parserOptions: generateParserOptions({ parser: { ts } }),
- env: {
- browser: true,
- es2021: true,
+ languageOptions: {
+ parser,
+ parserOptions: generateParserOptions({ parser: { ts } }),
+ globals: {
+ ...globals.browser,
+ ...globals.es2021,
+ },
},
};
}
diff --git a/tests/fixtures/integrations/parser-object-tests/ts-single-parser-setup.ts b/tests/fixtures/integrations/parser-object-tests/ts-single-parser-setup.ts
index c16f760b..38b04808 100644
--- a/tests/fixtures/integrations/parser-object-tests/ts-single-parser-setup.ts
+++ b/tests/fixtures/integrations/parser-object-tests/ts-single-parser-setup.ts
@@ -1,14 +1,18 @@
-/* eslint eslint-comments/require-description: 0, @typescript-eslint/explicit-module-boundary-types: 0 */
import { generateParserOptions } from "../../../src/parser/test-utils";
-import * as parser from "@typescript-eslint/parser";
+import * as ts from "@typescript-eslint/parser";
+import globals from "globals";
+import * as parser from "../../../../src";
+import type { Linter } from "eslint";
-export function getConfig() {
+export function getConfig(): Linter.Config {
return {
- parser: "svelte-eslint-parser",
- parserOptions: generateParserOptions({ parser }),
- env: {
- browser: true,
- es2021: true,
+ languageOptions: {
+ parser,
+ parserOptions: generateParserOptions({ parser: ts }),
+ globals: {
+ ...globals.browser,
+ ...globals.es2021,
+ },
},
};
}
diff --git a/tests/fixtures/integrations/scope-tests/ts-scope01-setup.ts b/tests/fixtures/integrations/scope-tests/ts-scope01-setup.ts
index 4f85b241..86bdc436 100644
--- a/tests/fixtures/integrations/scope-tests/ts-scope01-setup.ts
+++ b/tests/fixtures/integrations/scope-tests/ts-scope01-setup.ts
@@ -1,24 +1,24 @@
-/* eslint eslint-comments/require-description: 0, @typescript-eslint/explicit-module-boundary-types: 0 */
import type { Linter } from "eslint";
import { generateParserOptions } from "../../../src/parser/test-utils";
-import { rules } from "eslint-plugin-svelte";
-export function setupLinter(linter: Linter) {
- linter.defineRule(
- "svelte/no-immutable-reactive-statements",
- rules["no-immutable-reactive-statements"] as never,
- );
-}
+import * as svelte from "eslint-plugin-svelte";
+import globals from "globals";
+import * as parser from "../../../../src";
-export function getConfig() {
+export function getConfig(): Linter.Config {
return {
- parser: "svelte-eslint-parser",
- parserOptions: generateParserOptions(),
+ plugins: {
+ svelte: svelte as any,
+ },
+ languageOptions: {
+ parser,
+ parserOptions: generateParserOptions(),
+ globals: {
+ ...globals.browser,
+ ...globals.es2021,
+ },
+ },
rules: {
"svelte/no-immutable-reactive-statements": "error",
},
- env: {
- browser: true,
- es2021: true,
- },
};
}
diff --git a/tests/fixtures/integrations/snippet-scope/ts-snippet-hoist-scope-setup.ts b/tests/fixtures/integrations/snippet-scope/ts-snippet-hoist-scope-setup.ts
index 6ea0958b..e14f8589 100644
--- a/tests/fixtures/integrations/snippet-scope/ts-snippet-hoist-scope-setup.ts
+++ b/tests/fixtures/integrations/snippet-scope/ts-snippet-hoist-scope-setup.ts
@@ -1,27 +1,29 @@
-/* eslint eslint-comments/require-description: 0, @typescript-eslint/explicit-module-boundary-types: 0 */
import type { Linter } from "eslint";
import { generateParserOptions } from "../../../src/parser/test-utils";
import { rules } from "@typescript-eslint/eslint-plugin";
-export function setupLinter(linter: Linter) {
- linter.defineRule(
- "@typescript-eslint/no-unused-vars",
- rules["no-unused-vars"] as never,
- );
-}
+import * as parser from "../../../../src";
+import globals from "globals";
-export function getConfig() {
+export function getConfig(): Linter.Config {
return {
- parser: "svelte-eslint-parser",
- parserOptions: {
- ...generateParserOptions(),
- svelteFeatures: { runes: true },
+ plugins: {
+ "@typescript-eslint": {
+ rules: rules as any,
+ },
+ },
+ languageOptions: {
+ parser,
+ parserOptions: {
+ ...generateParserOptions(),
+ svelteFeatures: { runes: true },
+ },
+ globals: {
+ ...globals.browser,
+ ...globals.es2021,
+ },
},
rules: {
"@typescript-eslint/no-unused-vars": "error",
},
- env: {
- browser: true,
- es2021: true,
- },
};
}
diff --git a/tests/fixtures/integrations/type-info-tests/$derived-setup.ts b/tests/fixtures/integrations/type-info-tests/$derived-setup.ts
index d53704e5..1751c29e 100644
--- a/tests/fixtures/integrations/type-info-tests/$derived-setup.ts
+++ b/tests/fixtures/integrations/type-info-tests/$derived-setup.ts
@@ -1,36 +1,26 @@
-/* eslint eslint-comments/require-description: 0, @typescript-eslint/explicit-module-boundary-types: 0 */
import type { Linter } from "eslint";
import { generateParserOptions } from "../../../src/parser/test-utils";
import { rules } from "@typescript-eslint/eslint-plugin";
-export function setupLinter(linter: Linter) {
- linter.defineRule(
- "@typescript-eslint/no-unsafe-argument",
- rules["no-unsafe-argument"] as never,
- );
- linter.defineRule(
- "@typescript-eslint/no-unsafe-assignment",
- rules["no-unsafe-assignment"] as never,
- );
- linter.defineRule(
- "@typescript-eslint/no-unsafe-call",
- rules["no-unsafe-call"] as never,
- );
- linter.defineRule(
- "@typescript-eslint/no-unsafe-member-access",
- rules["no-unsafe-member-access"] as never,
- );
- linter.defineRule(
- "@typescript-eslint/no-unsafe-return",
- rules["no-unsafe-return"] as never,
- );
-}
+import * as parser from "../../../../src";
+import globals from "globals";
-export function getConfig() {
+export function getConfig(): Linter.Config {
return {
- parser: "svelte-eslint-parser",
- parserOptions: {
- ...generateParserOptions(),
- svelteFeatures: { runes: true },
+ plugins: {
+ "@typescript-eslint": {
+ rules: rules as any,
+ },
+ },
+ languageOptions: {
+ parser,
+ parserOptions: {
+ ...generateParserOptions(),
+ svelteFeatures: { runes: true },
+ },
+ globals: {
+ ...globals.browser,
+ ...globals.es2021,
+ },
},
rules: {
"@typescript-eslint/no-unsafe-argument": "error",
@@ -39,9 +29,5 @@ export function getConfig() {
"@typescript-eslint/no-unsafe-member-access": "error",
"@typescript-eslint/no-unsafe-return": "error",
},
- env: {
- browser: true,
- es2021: true,
- },
};
}
diff --git a/tests/fixtures/integrations/type-info-tests/$derived-ts-setup.ts b/tests/fixtures/integrations/type-info-tests/$derived-ts-setup.ts
index d53704e5..1751c29e 100644
--- a/tests/fixtures/integrations/type-info-tests/$derived-ts-setup.ts
+++ b/tests/fixtures/integrations/type-info-tests/$derived-ts-setup.ts
@@ -1,36 +1,26 @@
-/* eslint eslint-comments/require-description: 0, @typescript-eslint/explicit-module-boundary-types: 0 */
import type { Linter } from "eslint";
import { generateParserOptions } from "../../../src/parser/test-utils";
import { rules } from "@typescript-eslint/eslint-plugin";
-export function setupLinter(linter: Linter) {
- linter.defineRule(
- "@typescript-eslint/no-unsafe-argument",
- rules["no-unsafe-argument"] as never,
- );
- linter.defineRule(
- "@typescript-eslint/no-unsafe-assignment",
- rules["no-unsafe-assignment"] as never,
- );
- linter.defineRule(
- "@typescript-eslint/no-unsafe-call",
- rules["no-unsafe-call"] as never,
- );
- linter.defineRule(
- "@typescript-eslint/no-unsafe-member-access",
- rules["no-unsafe-member-access"] as never,
- );
- linter.defineRule(
- "@typescript-eslint/no-unsafe-return",
- rules["no-unsafe-return"] as never,
- );
-}
+import * as parser from "../../../../src";
+import globals from "globals";
-export function getConfig() {
+export function getConfig(): Linter.Config {
return {
- parser: "svelte-eslint-parser",
- parserOptions: {
- ...generateParserOptions(),
- svelteFeatures: { runes: true },
+ plugins: {
+ "@typescript-eslint": {
+ rules: rules as any,
+ },
+ },
+ languageOptions: {
+ parser,
+ parserOptions: {
+ ...generateParserOptions(),
+ svelteFeatures: { runes: true },
+ },
+ globals: {
+ ...globals.browser,
+ ...globals.es2021,
+ },
},
rules: {
"@typescript-eslint/no-unsafe-argument": "error",
@@ -39,9 +29,5 @@ export function getConfig() {
"@typescript-eslint/no-unsafe-member-access": "error",
"@typescript-eslint/no-unsafe-return": "error",
},
- env: {
- browser: true,
- es2021: true,
- },
};
}
diff --git a/tests/fixtures/integrations/type-info-tests/$derived2-setup.ts b/tests/fixtures/integrations/type-info-tests/$derived2-setup.ts
index d53704e5..1751c29e 100644
--- a/tests/fixtures/integrations/type-info-tests/$derived2-setup.ts
+++ b/tests/fixtures/integrations/type-info-tests/$derived2-setup.ts
@@ -1,36 +1,26 @@
-/* eslint eslint-comments/require-description: 0, @typescript-eslint/explicit-module-boundary-types: 0 */
import type { Linter } from "eslint";
import { generateParserOptions } from "../../../src/parser/test-utils";
import { rules } from "@typescript-eslint/eslint-plugin";
-export function setupLinter(linter: Linter) {
- linter.defineRule(
- "@typescript-eslint/no-unsafe-argument",
- rules["no-unsafe-argument"] as never,
- );
- linter.defineRule(
- "@typescript-eslint/no-unsafe-assignment",
- rules["no-unsafe-assignment"] as never,
- );
- linter.defineRule(
- "@typescript-eslint/no-unsafe-call",
- rules["no-unsafe-call"] as never,
- );
- linter.defineRule(
- "@typescript-eslint/no-unsafe-member-access",
- rules["no-unsafe-member-access"] as never,
- );
- linter.defineRule(
- "@typescript-eslint/no-unsafe-return",
- rules["no-unsafe-return"] as never,
- );
-}
+import * as parser from "../../../../src";
+import globals from "globals";
-export function getConfig() {
+export function getConfig(): Linter.Config {
return {
- parser: "svelte-eslint-parser",
- parserOptions: {
- ...generateParserOptions(),
- svelteFeatures: { runes: true },
+ plugins: {
+ "@typescript-eslint": {
+ rules: rules as any,
+ },
+ },
+ languageOptions: {
+ parser,
+ parserOptions: {
+ ...generateParserOptions(),
+ svelteFeatures: { runes: true },
+ },
+ globals: {
+ ...globals.browser,
+ ...globals.es2021,
+ },
},
rules: {
"@typescript-eslint/no-unsafe-argument": "error",
@@ -39,9 +29,5 @@ export function getConfig() {
"@typescript-eslint/no-unsafe-member-access": "error",
"@typescript-eslint/no-unsafe-return": "error",
},
- env: {
- browser: true,
- es2021: true,
- },
};
}
diff --git a/tests/fixtures/integrations/type-info-tests/$derived2-ts-setup.ts b/tests/fixtures/integrations/type-info-tests/$derived2-ts-setup.ts
index b1b1f599..1751c29e 100644
--- a/tests/fixtures/integrations/type-info-tests/$derived2-ts-setup.ts
+++ b/tests/fixtures/integrations/type-info-tests/$derived2-ts-setup.ts
@@ -1,36 +1,26 @@
-/* eslint eslint-comments/require-description: 0, @typescript-eslint/explicit-module-boundary-types: 0 */
import type { Linter } from "eslint";
import { generateParserOptions } from "../../../src/parser/test-utils";
import { rules } from "@typescript-eslint/eslint-plugin";
-export function setupLinter(linter: Linter) {
- linter.defineRule(
- "@typescript-eslint/no-unsafe-argument",
- rules["no-unsafe-argument"] as never
- );
- linter.defineRule(
- "@typescript-eslint/no-unsafe-assignment",
- rules["no-unsafe-assignment"] as never
- );
- linter.defineRule(
- "@typescript-eslint/no-unsafe-call",
- rules["no-unsafe-call"] as never
- );
- linter.defineRule(
- "@typescript-eslint/no-unsafe-member-access",
- rules["no-unsafe-member-access"] as never
- );
- linter.defineRule(
- "@typescript-eslint/no-unsafe-return",
- rules["no-unsafe-return"] as never
- );
-}
+import * as parser from "../../../../src";
+import globals from "globals";
-export function getConfig() {
+export function getConfig(): Linter.Config {
return {
- parser: "svelte-eslint-parser",
- parserOptions: {
- ...generateParserOptions(),
- svelteFeatures: { runes: true },
+ plugins: {
+ "@typescript-eslint": {
+ rules: rules as any,
+ },
+ },
+ languageOptions: {
+ parser,
+ parserOptions: {
+ ...generateParserOptions(),
+ svelteFeatures: { runes: true },
+ },
+ globals: {
+ ...globals.browser,
+ ...globals.es2021,
+ },
},
rules: {
"@typescript-eslint/no-unsafe-argument": "error",
@@ -39,9 +29,5 @@ export function getConfig() {
"@typescript-eslint/no-unsafe-member-access": "error",
"@typescript-eslint/no-unsafe-return": "error",
},
- env: {
- browser: true,
- es2021: true,
- },
};
}
diff --git a/tests/fixtures/integrations/type-info-tests/$props-setup.ts b/tests/fixtures/integrations/type-info-tests/$props-setup.ts
index d53704e5..1751c29e 100644
--- a/tests/fixtures/integrations/type-info-tests/$props-setup.ts
+++ b/tests/fixtures/integrations/type-info-tests/$props-setup.ts
@@ -1,36 +1,26 @@
-/* eslint eslint-comments/require-description: 0, @typescript-eslint/explicit-module-boundary-types: 0 */
import type { Linter } from "eslint";
import { generateParserOptions } from "../../../src/parser/test-utils";
import { rules } from "@typescript-eslint/eslint-plugin";
-export function setupLinter(linter: Linter) {
- linter.defineRule(
- "@typescript-eslint/no-unsafe-argument",
- rules["no-unsafe-argument"] as never,
- );
- linter.defineRule(
- "@typescript-eslint/no-unsafe-assignment",
- rules["no-unsafe-assignment"] as never,
- );
- linter.defineRule(
- "@typescript-eslint/no-unsafe-call",
- rules["no-unsafe-call"] as never,
- );
- linter.defineRule(
- "@typescript-eslint/no-unsafe-member-access",
- rules["no-unsafe-member-access"] as never,
- );
- linter.defineRule(
- "@typescript-eslint/no-unsafe-return",
- rules["no-unsafe-return"] as never,
- );
-}
+import * as parser from "../../../../src";
+import globals from "globals";
-export function getConfig() {
+export function getConfig(): Linter.Config {
return {
- parser: "svelte-eslint-parser",
- parserOptions: {
- ...generateParserOptions(),
- svelteFeatures: { runes: true },
+ plugins: {
+ "@typescript-eslint": {
+ rules: rules as any,
+ },
+ },
+ languageOptions: {
+ parser,
+ parserOptions: {
+ ...generateParserOptions(),
+ svelteFeatures: { runes: true },
+ },
+ globals: {
+ ...globals.browser,
+ ...globals.es2021,
+ },
},
rules: {
"@typescript-eslint/no-unsafe-argument": "error",
@@ -39,9 +29,5 @@ export function getConfig() {
"@typescript-eslint/no-unsafe-member-access": "error",
"@typescript-eslint/no-unsafe-return": "error",
},
- env: {
- browser: true,
- es2021: true,
- },
};
}
diff --git a/tests/fixtures/integrations/type-info-tests/await-setup.ts b/tests/fixtures/integrations/type-info-tests/await-setup.ts
index d1038fe0..0776177e 100644
--- a/tests/fixtures/integrations/type-info-tests/await-setup.ts
+++ b/tests/fixtures/integrations/type-info-tests/await-setup.ts
@@ -1,24 +1,26 @@
-/* eslint eslint-comments/require-description: 0, @typescript-eslint/explicit-module-boundary-types: 0 */
import type { Linter } from "eslint";
import { generateParserOptions } from "../../../src/parser/test-utils";
import { rules } from "@typescript-eslint/eslint-plugin";
-export function setupLinter(linter: Linter) {
- linter.defineRule(
- "@typescript-eslint/no-unsafe-call",
- rules["no-unsafe-call"] as never,
- );
-}
+import * as parser from "../../../../src";
+import globals from "globals";
-export function getConfig() {
+export function getConfig(): Linter.Config {
return {
- parser: "svelte-eslint-parser",
- parserOptions: generateParserOptions(),
+ plugins: {
+ "@typescript-eslint": {
+ rules: rules as any,
+ },
+ },
+ languageOptions: {
+ parser,
+ parserOptions: generateParserOptions(),
+ globals: {
+ ...globals.browser,
+ ...globals.es2021,
+ },
+ },
rules: {
"@typescript-eslint/no-unsafe-call": "error",
},
- env: {
- browser: true,
- es2021: true,
- },
};
}
diff --git a/tests/fixtures/integrations/type-info-tests/await-with-same-id-setup.ts b/tests/fixtures/integrations/type-info-tests/await-with-same-id-setup.ts
index 43276b18..1172dc96 100644
--- a/tests/fixtures/integrations/type-info-tests/await-with-same-id-setup.ts
+++ b/tests/fixtures/integrations/type-info-tests/await-with-same-id-setup.ts
@@ -1,24 +1,26 @@
-/* eslint eslint-comments/require-description: 0, @typescript-eslint/explicit-module-boundary-types: 0 */
import type { Linter } from "eslint";
import { generateParserOptions } from "../../../src/parser/test-utils";
import { rules } from "@typescript-eslint/eslint-plugin";
-export function setupLinter(linter: Linter) {
- linter.defineRule(
- "@typescript-eslint/no-unsafe-member-access",
- rules["no-unsafe-member-access"] as never,
- );
-}
+import * as parser from "../../../../src";
+import globals from "globals";
-export function getConfig() {
+export function getConfig(): Linter.Config {
return {
- parser: "svelte-eslint-parser",
- parserOptions: generateParserOptions(),
+ plugins: {
+ "@typescript-eslint": {
+ rules: rules as any,
+ },
+ },
+ languageOptions: {
+ parser,
+ parserOptions: generateParserOptions(),
+ globals: {
+ ...globals.browser,
+ ...globals.es2021,
+ },
+ },
rules: {
"@typescript-eslint/no-unsafe-member-access": "error",
},
- env: {
- browser: true,
- es2021: true,
- },
};
}
diff --git a/tests/fixtures/integrations/type-info-tests/i18n-setup.ts b/tests/fixtures/integrations/type-info-tests/i18n-setup.ts
index d1038fe0..0776177e 100644
--- a/tests/fixtures/integrations/type-info-tests/i18n-setup.ts
+++ b/tests/fixtures/integrations/type-info-tests/i18n-setup.ts
@@ -1,24 +1,26 @@
-/* eslint eslint-comments/require-description: 0, @typescript-eslint/explicit-module-boundary-types: 0 */
import type { Linter } from "eslint";
import { generateParserOptions } from "../../../src/parser/test-utils";
import { rules } from "@typescript-eslint/eslint-plugin";
-export function setupLinter(linter: Linter) {
- linter.defineRule(
- "@typescript-eslint/no-unsafe-call",
- rules["no-unsafe-call"] as never,
- );
-}
+import * as parser from "../../../../src";
+import globals from "globals";
-export function getConfig() {
+export function getConfig(): Linter.Config {
return {
- parser: "svelte-eslint-parser",
- parserOptions: generateParserOptions(),
+ plugins: {
+ "@typescript-eslint": {
+ rules: rules as any,
+ },
+ },
+ languageOptions: {
+ parser,
+ parserOptions: generateParserOptions(),
+ globals: {
+ ...globals.browser,
+ ...globals.es2021,
+ },
+ },
rules: {
"@typescript-eslint/no-unsafe-call": "error",
},
- env: {
- browser: true,
- es2021: true,
- },
};
}
diff --git a/tests/fixtures/integrations/type-info-tests/issue226-setup.ts b/tests/fixtures/integrations/type-info-tests/issue226-setup.ts
index b3c17593..2b458b9d 100644
--- a/tests/fixtures/integrations/type-info-tests/issue226-setup.ts
+++ b/tests/fixtures/integrations/type-info-tests/issue226-setup.ts
@@ -1,24 +1,26 @@
-/* eslint eslint-comments/require-description: 0, @typescript-eslint/explicit-module-boundary-types: 0 */
import type { Linter } from "eslint";
import { generateParserOptions } from "../../../src/parser/test-utils";
import { rules } from "@typescript-eslint/eslint-plugin";
-export function setupLinter(linter: Linter) {
- linter.defineRule(
- "@typescript-eslint/no-unsafe-argument",
- rules["no-unsafe-argument"] as never,
- );
-}
+import * as parser from "../../../../src";
+import globals from "globals";
-export function getConfig() {
+export function getConfig(): Linter.Config {
return {
- parser: "svelte-eslint-parser",
- parserOptions: generateParserOptions(),
+ plugins: {
+ "@typescript-eslint": {
+ rules: rules as any,
+ },
+ },
+ languageOptions: {
+ parser,
+ parserOptions: generateParserOptions(),
+ globals: {
+ ...globals.browser,
+ ...globals.es2021,
+ },
+ },
rules: {
"@typescript-eslint/no-unsafe-argument": "error",
},
- env: {
- browser: true,
- es2021: true,
- },
};
}
diff --git a/tests/fixtures/integrations/type-info-tests/no-unnecessary-condition01-output.json b/tests/fixtures/integrations/type-info-tests/no-unnecessary-condition01-output.json
index e998aae6..1f5ff21f 100644
--- a/tests/fixtures/integrations/type-info-tests/no-unnecessary-condition01-output.json
+++ b/tests/fixtures/integrations/type-info-tests/no-unnecessary-condition01-output.json
@@ -4,13 +4,13 @@
"code": "foo == null",
"line": 4,
"column": 15,
- "message": "Unnecessary conditional, both sides of the expression are literal values."
+ "message": "Unnecessary conditional, comparison is always true. Both sides of the comparison always have a literal type."
},
{
"ruleId": "@typescript-eslint/no-unnecessary-condition",
"code": "bar == null",
"line": 8,
"column": 13,
- "message": "Unnecessary conditional, both sides of the expression are literal values."
+ "message": "Unnecessary conditional, comparison is always true. Both sides of the comparison always have a literal type."
}
]
\ No newline at end of file
diff --git a/tests/fixtures/integrations/type-info-tests/no-unnecessary-condition01-setup.ts b/tests/fixtures/integrations/type-info-tests/no-unnecessary-condition01-setup.ts
index 640da051..14872ebb 100644
--- a/tests/fixtures/integrations/type-info-tests/no-unnecessary-condition01-setup.ts
+++ b/tests/fixtures/integrations/type-info-tests/no-unnecessary-condition01-setup.ts
@@ -1,24 +1,26 @@
-/* eslint eslint-comments/require-description: 0, @typescript-eslint/explicit-module-boundary-types: 0 */
import type { Linter } from "eslint";
import { generateParserOptions } from "../../../src/parser/test-utils";
import { rules } from "@typescript-eslint/eslint-plugin";
-export function setupLinter(linter: Linter) {
- linter.defineRule(
- "@typescript-eslint/no-unnecessary-condition",
- rules["no-unnecessary-condition"] as never,
- );
-}
+import * as parser from "../../../../src";
+import globals from "globals";
-export function getConfig() {
+export function getConfig(): Linter.Config {
return {
- parser: "svelte-eslint-parser",
- parserOptions: generateParserOptions(),
+ plugins: {
+ "@typescript-eslint": {
+ rules: rules as any,
+ },
+ },
+ languageOptions: {
+ parser,
+ parserOptions: generateParserOptions(),
+ globals: {
+ ...globals.browser,
+ ...globals.es2021,
+ },
+ },
rules: {
"@typescript-eslint/no-unnecessary-condition": "error",
},
- env: {
- browser: true,
- es2021: true,
- },
};
}
diff --git a/tests/fixtures/integrations/type-info-tests/no-unnecessary-condition02-setup.ts b/tests/fixtures/integrations/type-info-tests/no-unnecessary-condition02-setup.ts
index 3ba264cf..4f83da96 100644
--- a/tests/fixtures/integrations/type-info-tests/no-unnecessary-condition02-setup.ts
+++ b/tests/fixtures/integrations/type-info-tests/no-unnecessary-condition02-setup.ts
@@ -1,2 +1 @@
-/* eslint eslint-comments/require-description: 0, @typescript-eslint/explicit-module-boundary-types: 0 */
export * from "./no-unnecessary-condition01-setup";
diff --git a/tests/fixtures/integrations/type-info-tests/no-unnecessary-condition03-setup.ts b/tests/fixtures/integrations/type-info-tests/no-unnecessary-condition03-setup.ts
index 3ba264cf..4f83da96 100644
--- a/tests/fixtures/integrations/type-info-tests/no-unnecessary-condition03-setup.ts
+++ b/tests/fixtures/integrations/type-info-tests/no-unnecessary-condition03-setup.ts
@@ -1,2 +1 @@
-/* eslint eslint-comments/require-description: 0, @typescript-eslint/explicit-module-boundary-types: 0 */
export * from "./no-unnecessary-condition01-setup";
diff --git a/tests/fixtures/integrations/type-info-tests/plugin-issue254-setup.ts b/tests/fixtures/integrations/type-info-tests/plugin-issue254-setup.ts
index 640da051..14872ebb 100644
--- a/tests/fixtures/integrations/type-info-tests/plugin-issue254-setup.ts
+++ b/tests/fixtures/integrations/type-info-tests/plugin-issue254-setup.ts
@@ -1,24 +1,26 @@
-/* eslint eslint-comments/require-description: 0, @typescript-eslint/explicit-module-boundary-types: 0 */
import type { Linter } from "eslint";
import { generateParserOptions } from "../../../src/parser/test-utils";
import { rules } from "@typescript-eslint/eslint-plugin";
-export function setupLinter(linter: Linter) {
- linter.defineRule(
- "@typescript-eslint/no-unnecessary-condition",
- rules["no-unnecessary-condition"] as never,
- );
-}
+import * as parser from "../../../../src";
+import globals from "globals";
-export function getConfig() {
+export function getConfig(): Linter.Config {
return {
- parser: "svelte-eslint-parser",
- parserOptions: generateParserOptions(),
+ plugins: {
+ "@typescript-eslint": {
+ rules: rules as any,
+ },
+ },
+ languageOptions: {
+ parser,
+ parserOptions: generateParserOptions(),
+ globals: {
+ ...globals.browser,
+ ...globals.es2021,
+ },
+ },
rules: {
"@typescript-eslint/no-unnecessary-condition": "error",
},
- env: {
- browser: true,
- es2021: true,
- },
};
}
diff --git a/tests/fixtures/integrations/type-info-tests/reactive-setup.ts b/tests/fixtures/integrations/type-info-tests/reactive-setup.ts
index ecf35dd1..12eb3010 100644
--- a/tests/fixtures/integrations/type-info-tests/reactive-setup.ts
+++ b/tests/fixtures/integrations/type-info-tests/reactive-setup.ts
@@ -1,34 +1,24 @@
-/* eslint eslint-comments/require-description: 0, @typescript-eslint/explicit-module-boundary-types: 0 */
import type { Linter } from "eslint";
import { generateParserOptions } from "../../../src/parser/test-utils";
import { rules } from "@typescript-eslint/eslint-plugin";
-export function setupLinter(linter: Linter) {
- linter.defineRule(
- "@typescript-eslint/no-unsafe-argument",
- rules["no-unsafe-argument"] as never,
- );
- linter.defineRule(
- "@typescript-eslint/no-unsafe-assignment",
- rules["no-unsafe-assignment"] as never,
- );
- linter.defineRule(
- "@typescript-eslint/no-unsafe-call",
- rules["no-unsafe-call"] as never,
- );
- linter.defineRule(
- "@typescript-eslint/no-unsafe-member-access",
- rules["no-unsafe-member-access"] as never,
- );
- linter.defineRule(
- "@typescript-eslint/no-unsafe-return",
- rules["no-unsafe-return"] as never,
- );
-}
+import * as parser from "../../../../src";
+import globals from "globals";
-export function getConfig() {
+export function getConfig(): Linter.Config {
return {
- parser: "svelte-eslint-parser",
- parserOptions: generateParserOptions(),
+ plugins: {
+ "@typescript-eslint": {
+ rules: rules as any,
+ },
+ },
+ languageOptions: {
+ parser,
+ parserOptions: generateParserOptions(),
+ globals: {
+ ...globals.browser,
+ ...globals.es2021,
+ },
+ },
rules: {
"@typescript-eslint/no-unsafe-argument": "error",
"@typescript-eslint/no-unsafe-assignment": "error",
@@ -36,9 +26,5 @@ export function getConfig() {
"@typescript-eslint/no-unsafe-member-access": "error",
"@typescript-eslint/no-unsafe-return": "error",
},
- env: {
- browser: true,
- es2021: true,
- },
};
}
diff --git a/tests/fixtures/integrations/type-info-tests/reactive2-setup.ts b/tests/fixtures/integrations/type-info-tests/reactive2-setup.ts
index 93fee4aa..5804c700 100644
--- a/tests/fixtures/integrations/type-info-tests/reactive2-setup.ts
+++ b/tests/fixtures/integrations/type-info-tests/reactive2-setup.ts
@@ -1,29 +1,27 @@
-/* eslint eslint-comments/require-description: 0, @typescript-eslint/explicit-module-boundary-types: 0 */
import type { Linter } from "eslint";
import { generateParserOptions } from "../../../src/parser/test-utils";
import { rules } from "@typescript-eslint/eslint-plugin";
-export function setupLinter(linter: Linter) {
- linter.defineRule(
- "@typescript-eslint/no-unsafe-assignment",
- rules["no-unsafe-assignment"] as never,
- );
- linter.defineRule(
- "@typescript-eslint/no-unsafe-member-access",
- rules["no-unsafe-member-access"] as never,
- );
-}
+import * as parser from "../../../../src";
+import globals from "globals";
-export function getConfig() {
+export function getConfig(): Linter.Config {
return {
- parser: "svelte-eslint-parser",
- parserOptions: generateParserOptions(),
+ plugins: {
+ "@typescript-eslint": {
+ rules: rules as any,
+ },
+ },
+ languageOptions: {
+ parser,
+ parserOptions: generateParserOptions(),
+ globals: {
+ ...globals.browser,
+ ...globals.es2021,
+ },
+ },
rules: {
"@typescript-eslint/no-unsafe-assignment": "error",
"@typescript-eslint/no-unsafe-member-access": "error",
},
- env: {
- browser: true,
- es2021: true,
- },
};
}
diff --git a/tests/fixtures/integrations/type-info-tests/ts-newline-setup.ts b/tests/fixtures/integrations/type-info-tests/ts-newline-setup.ts
index edeef56f..a1a075a0 100644
--- a/tests/fixtures/integrations/type-info-tests/ts-newline-setup.ts
+++ b/tests/fixtures/integrations/type-info-tests/ts-newline-setup.ts
@@ -1,30 +1,28 @@
-/* eslint eslint-comments/require-description: 0, @typescript-eslint/explicit-module-boundary-types: 0 */
import type { Linter } from "eslint";
import { generateParserOptions } from "../../../src/parser/test-utils";
import { rules } from "@typescript-eslint/eslint-plugin";
-export function setupLinter(linter: Linter) {
- linter.defineRule(
- "@typescript-eslint/no-confusing-void-expression",
- rules["no-confusing-void-expression"] as never,
- );
- linter.defineRule(
- "@typescript-eslint/explicit-function-return-type",
- rules["explicit-function-return-type"] as never,
- );
-}
+import * as parser from "../../../../src";
+import globals from "globals";
-export function getConfig() {
+export function getConfig(): Linter.Config {
return {
- parser: "svelte-eslint-parser",
- parserOptions: generateParserOptions(),
+ plugins: {
+ "@typescript-eslint": {
+ rules: rules as any,
+ },
+ },
+ languageOptions: {
+ parser,
+ parserOptions: generateParserOptions(),
+ globals: {
+ ...globals.browser,
+ ...globals.es2021,
+ },
+ },
rules: {
"@typescript-eslint/no-confusing-void-expression": "error",
"@typescript-eslint/explicit-function-return-type": "error",
"no-unreachable": "error",
},
- env: {
- browser: true,
- es2021: true,
- },
};
}
diff --git a/tests/fixtures/integrations/type-info-tests/ts-no-misused-promises-setup.ts b/tests/fixtures/integrations/type-info-tests/ts-no-misused-promises-setup.ts
index 6e8c0fd0..f8a6a783 100644
--- a/tests/fixtures/integrations/type-info-tests/ts-no-misused-promises-setup.ts
+++ b/tests/fixtures/integrations/type-info-tests/ts-no-misused-promises-setup.ts
@@ -1,24 +1,26 @@
-/* eslint eslint-comments/require-description: 0, @typescript-eslint/explicit-module-boundary-types: 0 */
import type { Linter } from "eslint";
import { generateParserOptions } from "../../../src/parser/test-utils";
import { rules } from "@typescript-eslint/eslint-plugin";
-export function setupLinter(linter: Linter) {
- linter.defineRule(
- "@typescript-eslint/no-misused-promises",
- rules["no-misused-promises"] as never,
- );
-}
+import * as parser from "../../../../src";
+import globals from "globals";
-export function getConfig() {
+export function getConfig(): Linter.Config {
return {
- parser: "svelte-eslint-parser",
- parserOptions: generateParserOptions(),
+ plugins: {
+ "@typescript-eslint": {
+ rules: rules as any,
+ },
+ },
+ languageOptions: {
+ parser,
+ parserOptions: generateParserOptions(),
+ globals: {
+ ...globals.browser,
+ ...globals.es2021,
+ },
+ },
rules: {
"@typescript-eslint/no-misused-promises": "error",
},
- env: {
- browser: true,
- es2021: true,
- },
};
}
diff --git a/tests/fixtures/parser/ast/docs/template-syntax/11-element-directives/02-bind-property/10-no-undef-result.json b/tests/fixtures/parser/ast/docs/template-syntax/11-element-directives/02-bind-property/10-no-undef-result.json
index e5ec64d6..4900ea3b 100644
--- a/tests/fixtures/parser/ast/docs/template-syntax/11-element-directives/02-bind-property/10-no-undef-result.json
+++ b/tests/fixtures/parser/ast/docs/template-syntax/11-element-directives/02-bind-property/10-no-undef-result.json
@@ -41,12 +41,6 @@
"line": 8,
"column": 7
},
- {
- "ruleId": "no-undef",
- "code": "currentTime",
- "line": 9,
- "column": 7
- },
{
"ruleId": "no-undef",
"code": "playbackRate",
diff --git a/tests/src/integrations.ts b/tests/src/integrations.ts
index 7112558b..9abbbafb 100644
--- a/tests/src/integrations.ts
+++ b/tests/src/integrations.ts
@@ -2,6 +2,7 @@
import { Linter } from "eslint";
import assert from "assert";
import fs from "fs";
+import globals from "globals";
import * as parser from "../../src";
import {
generateParserOptions,
@@ -12,14 +13,6 @@ import path from "path";
const FIXTURE_ROOT = path.resolve(__dirname, "../fixtures/integrations");
-function createLinter() {
- const linter = new Linter();
-
- linter.defineParser("svelte-eslint-parser", parser as any);
-
- return linter;
-}
-
describe("Integration tests.", () => {
for (const {
input,
@@ -40,17 +33,21 @@ describe("Integration tests.", () => {
? // eslint-disable-next-line @typescript-eslint/no-require-imports -- test
require(setupFileName)
: null;
- const linter = createLinter();
- setup?.setupLinter?.(linter);
+ const linter = new Linter();
const messages = linter.verify(
input,
- setup?.getConfig?.() ?? {
- parser: "svelte-eslint-parser",
- parserOptions: generateParserOptions(config),
- env: {
- browser: true,
- es2021: true,
- },
+ {
+ files: ["**"],
+ ...(setup?.getConfig?.() ?? {
+ languageOptions: {
+ parser,
+ parserOptions: generateParserOptions(config),
+ globals: {
+ ...globals.browser,
+ ...globals.es2021,
+ },
+ },
+ }),
},
inputFileName,
);
diff --git a/tests/src/parser/eslint-rules.ts b/tests/src/parser/eslint-rules.ts
index 967b8700..742d5d48 100644
--- a/tests/src/parser/eslint-rules.ts
+++ b/tests/src/parser/eslint-rules.ts
@@ -1,6 +1,7 @@
import { Linter } from "eslint";
import assert from "assert";
import fs from "fs";
+import globals from "globals";
import * as parser from "../../../src/index";
import {
generateParserOptions,
@@ -8,14 +9,6 @@ import {
listupFixtures,
} from "./test-utils";
-function createLinter() {
- const linter = new Linter();
-
- linter.defineParser("svelte-eslint-parser", parser as any);
-
- return linter;
-}
-
//------------------------------------------------------------------------------
// Tests
//------------------------------------------------------------------------------
@@ -46,7 +39,7 @@ describe("svelte-eslint-parser with ESLint rules", () => {
if (!meetRequirements("parse")) {
continue;
}
- const linter = createLinter();
+ const linter = new Linter();
describe(inputFileName, () => {
for (const rule of RULES) {
it(rule, () => {
@@ -54,15 +47,18 @@ describe("svelte-eslint-parser with ESLint rules", () => {
const messages = linter.verify(
input,
{
- parser: "svelte-eslint-parser",
- parserOptions: generateParserOptions(config),
+ files: ["**"],
+ languageOptions: {
+ parser,
+ parserOptions: generateParserOptions(config),
+ globals: {
+ ...globals.browser,
+ ...globals.es2021,
+ },
+ },
rules: {
[rule]: "error",
},
- env: {
- browser: true,
- es2021: true,
- },
},
inputFileName,
);
diff --git a/tests/src/parser/eslint.ts b/tests/src/parser/eslint.ts
index 4025c519..59a926c7 100644
--- a/tests/src/parser/eslint.ts
+++ b/tests/src/parser/eslint.ts
@@ -1,17 +1,10 @@
import { Linter } from "eslint";
import assert from "assert";
import semver from "semver";
+import globals from "globals";
import * as parser from "../../../src/index";
import { generateParserOptions } from "./test-utils";
-function createLinter() {
- const linter = new Linter();
-
- linter.defineParser("svelte-eslint-parser", parser as any);
-
- return linter;
-}
-
//------------------------------------------------------------------------------
// Tests
//------------------------------------------------------------------------------
@@ -20,23 +13,31 @@ describe("eslint custom parser", () => {
it("should work with eslint.", () => {
const code = `Hello!
`;
- const linter = createLinter();
- linter.defineRule("test", {
- create(context) {
- return {
- SvelteElement(node: any) {
- context.report({
- node,
- message: "test",
- });
+ const linter = new Linter();
+ const messages = linter.verify(code, {
+ plugins: {
+ test: {
+ rules: {
+ test: {
+ create(context) {
+ return {
+ SvelteElement(node: any) {
+ context.report({
+ node,
+ message: "test",
+ });
+ },
+ };
+ },
+ },
},
- };
+ },
+ },
+ languageOptions: {
+ parser,
},
- });
- const messages = linter.verify(code, {
- parser: "svelte-eslint-parser",
rules: {
- test: "error",
+ "test/test": "error",
},
});
@@ -243,10 +244,16 @@ describe("eslint custom parser", () => {
for (const { code, output, messages, parserOptions } of tests) {
it(code, () => {
- const linter = createLinter();
+ const linter = new Linter();
const result = linter.verifyAndFix(code, {
- parser: "svelte-eslint-parser",
- parserOptions: generateParserOptions(parserOptions),
+ languageOptions: {
+ parser,
+ parserOptions: generateParserOptions(parserOptions),
+ globals: {
+ ...globals.browser,
+ ...globals.es2021,
+ },
+ },
rules: {
"no-unused-labels": "error",
"no-extra-label": "error",
@@ -255,10 +262,6 @@ describe("eslint custom parser", () => {
"no-unused-expressions": "error",
"space-infix-ops": "error",
},
- env: {
- browser: true,
- es2021: true,
- },
});
assert.deepStrictEqual(
diff --git a/tests/src/scope/scope.ts b/tests/src/scope/scope.ts
index 4b8c4397..cd267151 100644
--- a/tests/src/scope/scope.ts
+++ b/tests/src/scope/scope.ts
@@ -6,21 +6,28 @@ import type { Scope } from "eslint-scope";
function generateScopeTestCase(code: string, selector: string, type: string) {
const linter = new Linter();
let scope: Scope;
- linter.defineParser("svelte-eslint-parser", parser as any);
- linter.defineRule("test", {
- create(context) {
- return {
- [selector]() {
- scope = context.getScope();
+ linter.verify(code, {
+ plugins: {
+ test: {
+ rules: {
+ test: {
+ create(context) {
+ return {
+ [selector](node: any) {
+ scope = context.sourceCode.getScope(node);
+ },
+ };
+ },
+ },
},
- };
+ },
+ },
+ languageOptions: {
+ parser,
+ parserOptions: { ecmaVersion: 2020, sourceType: "module" },
},
- });
- linter.verify(code, {
- parser: "svelte-eslint-parser",
- parserOptions: { ecmaVersion: 2020, sourceType: "module" },
rules: {
- test: "error",
+ "test/test": "error",
},
});
assert.strictEqual(scope!.type, type);
diff --git a/tools/update-fixtures.ts b/tools/update-fixtures.ts
index cc43ee7e..fb00cad1 100644
--- a/tools/update-fixtures.ts
+++ b/tools/update-fixtures.ts
@@ -14,6 +14,7 @@ import {
} from "../tests/src/parser/test-utils";
import type ts from "typescript";
import type ESTree from "estree";
+import globals from "globals";
import type { SourceLocation } from "../src/ast";
const ERROR_FIXTURE_ROOT = path.resolve(
@@ -88,21 +89,24 @@ for (const {
throw e;
}
- const linter = createLinter();
+ const linter = new Linter();
for (const rule of RULES) {
const ruleOutputFileName = getRuleOutputFileName(rule);
const messages = linter.verify(
input,
{
- parser: "svelte-eslint-parser",
- parserOptions: generateParserOptions(config),
+ files: ["**"],
+ languageOptions: {
+ parser,
+ parserOptions: generateParserOptions(config),
+ globals: {
+ ...globals.browser,
+ ...globals.es2021,
+ },
+ },
rules: {
[rule]: "error",
},
- env: {
- browser: true,
- es2021: true,
- },
},
inputFileName,
);
@@ -192,14 +196,6 @@ for (const {
);
}
-function createLinter() {
- const linter = new Linter();
-
- linter.defineParser("svelte-eslint-parser", parser as any);
-
- return linter;
-}
-
function buildTypes(
input: string,
result: {
diff --git a/tsconfig.json b/tsconfig.json
index ae1218d9..1f44a58a 100644
--- a/tsconfig.json
+++ b/tsconfig.json
@@ -20,6 +20,7 @@
"src/**/*.ts",
"tests/**/*.ts",
"tools/**/*.ts",
- "benchmark/**/*.ts"
+ "benchmark/**/*.ts",
+ "explorer-v2/**/*.d.ts"
]
}