Skip to content

Commit

Permalink
migrate to new eslint config file
Browse files Browse the repository at this point in the history
  • Loading branch information
mishankov committed Oct 1, 2024
1 parent 4ab4236 commit c6dedb4
Show file tree
Hide file tree
Showing 4 changed files with 89 additions and 34 deletions.
31 changes: 0 additions & 31 deletions .eslintrc.cjs

This file was deleted.

68 changes: 68 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
import typescriptEslint from "@typescript-eslint/eslint-plugin";
import globals from "globals";
import tsParser from "@typescript-eslint/parser";
import parser from "svelte-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: [
"**/.DS_Store",
"**/node_modules",
"build",
".svelte-kit",
"package",
"**/.env",
"**/.env.*",
"!**/.env.example",
"**/pnpm-lock.yaml",
"**/package-lock.json",
"**/yarn.lock",
],
}, ...compat.extends(
"eslint:recommended",
"plugin:@typescript-eslint/recommended",
"plugin:svelte/recommended",
"prettier",
), {
plugins: {
"@typescript-eslint": typescriptEslint,
},

languageOptions: {
globals: {
...globals.browser,
...globals.node,
},

parser: tsParser,
ecmaVersion: 2020,
sourceType: "module",

parserOptions: {
extraFileExtensions: [".svelte"],
},
},
}, {
files: ["**/*.svelte"],

languageOptions: {
parser: parser,
ecmaVersion: 5,
sourceType: "script",

parserOptions: {
parser: "@typescript-eslint/parser",
},
},
}];
21 changes: 18 additions & 3 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
"format": "prettier --write ."
},
"devDependencies": {
"@eslint/eslintrc": "^3.1.0",
"@eslint/js": "^9.11.1",
"@sveltejs/adapter-auto": "^3.2.5",
"@sveltejs/adapter-static": "^3.0.5",
"@sveltejs/kit": "^2.6.1",
Expand All @@ -24,6 +26,7 @@
"eslint": "^9.11.1",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-svelte": "^2.44.1",
"globals": "^15.9.0",
"prettier": "^3.3.3",
"prettier-plugin-svelte": "^3.2.7",
"svelte": "^4.2.19",
Expand Down

0 comments on commit c6dedb4

Please sign in to comment.