Skip to content

Commit

Permalink
Completed migration to ESLint's flat config format
Browse files Browse the repository at this point in the history
  • Loading branch information
avi12 committed Apr 13, 2024
1 parent 038ddd3 commit 41f28fe
Show file tree
Hide file tree
Showing 3 changed files with 171 additions and 133 deletions.
102 changes: 29 additions & 73 deletions eslint.config.js
Original file line number Diff line number Diff line change
@@ -1,77 +1,33 @@
import { FlatCompat } from "@eslint/eslintrc";
import js from "@eslint/js";
import path from "path";
import { fileURLToPath } from "url";

const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);

const compat = new FlatCompat({
baseDirectory: __dirname,
recommendedConfig: js.configs.recommended
});
import eslint from "@eslint/js";
import avi12 from "eslint-config-avi12";
import svelteEslint from "eslint-plugin-svelte";
import globals from "globals";
import svelteParser from "svelte-eslint-parser";
import tsEslint from "typescript-eslint";

export default [
...compat.config({
parser: "@typescript-eslint/parser",
parserOptions: {
ecmaVersion: "latest",
sourceType: "module",
lib: ["dom", "esnext"]
},
overrides: [
{
files: ["*.svelte"],
parser: "svelte-eslint-parser",
parserOptions: {
parser: "@typescript-eslint/parser"
}
eslint.configs.recommended,
...tsEslint.configs.recommended,
...svelteEslint.configs["flat/recommended"],
{
files: ["**/*.svelte"],
languageOptions: {
parser: svelteParser,
parserOptions: {
parser: tsEslint.parser
},
globals: {
...globals.browser,
...globals.node,
chrome: true
}
],
rules: {
"arrow-parens": ["warn", "as-needed"],
"prefer-const": "warn",
"no-async-promise-executor": "off",
semi: ["warn", "always"],
quotes: [
"warn",
"double",
{
allowTemplateLiterals: true
}
],
indent: [
"warn",
2,
{
SwitchCase: 1
}
],
"no-unused-vars": "off",
"@typescript-eslint/no-unused-vars": ["warn"],
"object-curly-spacing": ["warn", "always"],
"quote-props": ["warn", "as-needed"],
"comma-dangle": ["warn", "never"],
curly: ["warn", "all"],
"array-element-newline": ["warn", "consistent"],
"import/order": ["warn", { groups: ["external", "internal"], alphabetize: { order: "asc" } }],
"object-property-newline": [
"warn",
{
allowMultiplePropertiesPerLine: true
}
]
},
env: {
browser: true,
es2024: true,
node: true,
webextensions: true
},
globals: {
chrome: true
},
plugins: ["svelte", "@typescript-eslint", "import"],
extends: ["eslint:recommended", "plugin:@typescript-eslint/recommended", "plugin:svelte/recommended"]
})
}
},
{
files: ["**/*.ts"],
languageOptions: {
parser: tsEslint.parser
}
},
...avi12
];
11 changes: 7 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@
"dependencies": {
"@plasmohq/storage": "^1.9.3",
"plasmo": "0.85.2",
"sass": "^1.74.1",
"svelte": "^4.2.13",
"sass": "^1.75.0",
"svelte": "^4.2.14",
"svelte-preprocess": "^5.1.3"
},
"devDependencies": {
Expand All @@ -39,12 +39,15 @@
"@typescript-eslint/eslint-plugin": "^7.6.0",
"autoprefixer": "^10.4.19",
"eslint": "^9.0.0",
"eslint-config-avi12": "github:avi12/eslint-config-avi12",
"eslint-config-svelte": "github:sveltejs/eslint-config",
"eslint-plugin-import": "^2.29.1",
"eslint-plugin-svelte": "^2.36.0",
"eslint-plugin-svelte": "^2.37.0",
"globals": "^15.0.0",
"postcss": "^8.4.38",
"prettier": "3.2.5",
"prettier-plugin-svelte": "^3.2.2",
"prettier-plugin-svelte": "^3.2.3",
"svelte-eslint-parser": "^0.34.1",
"typescript": "5.4.5",
"typescript-eslint": "^7.6.0",
"web-ext": "^7.11.0",
Expand Down
Loading

0 comments on commit 41f28fe

Please sign in to comment.