Skip to content

Commit

Permalink
build: migrate to eslint flat config as they call it
Browse files Browse the repository at this point in the history
Wouldn't have managed to do it without the examples found in
sveltejs/eslint-plugin-svelte#732
  • Loading branch information
n-peugnet committed Jul 30, 2024
1 parent 00874cc commit 3464abf
Show file tree
Hide file tree
Showing 5 changed files with 176 additions and 177 deletions.
40 changes: 0 additions & 40 deletions .eslintrc.yml

This file was deleted.

2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ check-svelte: node_modules

.PHONY: check-eslint
check-eslint: node_modules
$(BIN)/eslint src
$(BIN)/eslint src eslint.config.mjs

.PHONY: check-translations
check-translations:
Expand Down
43 changes: 43 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
import eslintPluginSvelte from "eslint-plugin-svelte";
import globals from "globals";
import js from "@eslint/js";
import svelteParser from "svelte-eslint-parser";
import tsEslint from "typescript-eslint";
import tsParser from "@typescript-eslint/parser";

export default [
js.configs.recommended,
...tsEslint.configs.strict,
...eslintPluginSvelte.configs["flat/recommended"],
{
languageOptions: {
ecmaVersion: 2020,
sourceType: "module",
},
rules: {
"linebreak-style": ["error", "unix"],
"semi": ["error", "always"],
"comma-dangle": ["error", {
arrays: "always-multiline",
objects: "always-multiline",
imports: "always-multiline",
functions: "only-multiline",
}],
"indent": ["error", "tab"],
"quotes": ["warn", "double"],
"@typescript-eslint/no-non-null-assertion": "off",
"@typescript-eslint/ban-ts-comment": "off",
},
},
{
files: ["**/*.svelte"],
languageOptions: {
parser: svelteParser,
globals: globals.browser,
parserOptions: {
parser: tsParser,
},
},
},
];

Loading

0 comments on commit 3464abf

Please sign in to comment.