Migrate to ESLint 9

This commit is contained in:
Emmanuel 2024-09-16 11:14:06 +02:00
parent dacbc57c27
commit 88ece76233
15 changed files with 1534 additions and 2470 deletions

View file

@ -1,12 +0,0 @@
.DS_Store
node_modules
/.svelte-kit
/build
/package
/*.env
!/example.env
# Ignore files for PNPM, NPM and YARN
package-lock.json
pnpm-lock.yaml
yarn.lock

View file

@ -1,30 +0,0 @@
module.exports = {
env: {
browser: true,
es2017: true,
node: true,
},
extends: [
"eslint:recommended",
"plugin:@typescript-eslint/recommended",
"plugin:svelte/recommended",
"prettier",
],
overrides: [
{
files: ["*.svelte"],
parser: "svelte-eslint-parser",
parserOptions: {
parser: "@typescript-eslint/parser",
},
},
],
parser: "@typescript-eslint/parser",
parserOptions: {
ecmaVersion: 2020,
extraFileExtensions: [".svelte"],
sourceType: "module",
},
plugins: ["@typescript-eslint"],
root: true,
}

19
.gitignore vendored
View file

@ -4,4 +4,23 @@ node_modules
/build
/dist
/*.env
!/example.envnode_modules
# Output
.output
.vercel
/.svelte-kit
/build
/dist
# OS
.DS_Store
Thumbs.db
# Env
/*.env
!/example.env
# Vite
vite.config.js.timestamp-*
vite.config.ts.timestamp-*

1
.npmrc
View file

@ -1,2 +1 @@
engine-strict=true
resolution-mode=highest

View file

@ -1,12 +1,4 @@
.DS_Store
node_modules
/.svelte-kit
/build
/package
/*.env
!/example.env
# Ignore files for PNPM, NPM and YARN
# Package Managers
package-lock.json
pnpm-lock.yaml
yarn.lock

6
.prettierrc Normal file
View file

@ -0,0 +1,6 @@
{
"overrides": [{ "files": "*.svelte", "options": { "parser": "svelte" } }],
"plugins": ["prettier-plugin-svelte"],
"semi": false,
"trailingComma": "all"
}

38
eslint.config.js Normal file
View file

@ -0,0 +1,38 @@
import js from "@eslint/js"
import ts from "typescript-eslint"
import svelte from "eslint-plugin-svelte"
import prettier from "eslint-config-prettier"
import globals from "globals"
/** @type {import('eslint').Linter.Config[]} */
export default [
js.configs.recommended,
...ts.configs.recommended,
...svelte.configs["flat/recommended"],
prettier,
...svelte.configs["flat/prettier"],
{
languageOptions: {
globals: {
...globals.browser,
...globals.node,
},
},
},
{
files: ["**/*.svelte"],
languageOptions: {
parserOptions: {
parser: ts.parser,
},
},
settings: {
svelte: {
ignoreWarnings: ["no-irregular-whitespace"],
},
},
},
{
ignores: ["build/", ".svelte-kit/", "dist/"],
},
]

3827
package-lock.json generated

File diff suppressed because it is too large Load diff

View file

@ -15,8 +15,8 @@
"check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch",
"configure": "tsx src/scripts/configure.ts",
"dev": "vite dev",
"format": "prettier --plugin=prettier-plugin-svelte --write .",
"lint": "prettier --check --plugin=prettier-plugin-svelte . && eslint .",
"format": "prettier --write .",
"lint": "prettier --check . && eslint .",
"package": "svelte-kit sync && svelte-package",
"preview": "vite preview",
"test": "playwright test"
@ -46,7 +46,7 @@
"@tricoteuses/explorer-tools": "^0.5.0",
"fast-xml-parser": "^4.3.2",
"he": "^1.2.0",
"jsdom": "^24.0.0"
"jsdom": "^25.0.0"
},
"devDependencies": {
"@iconify-icons/codicon": "^1.2.15",
@ -56,43 +56,41 @@
"@sveltejs/vite-plugin-svelte": "^3.0.0",
"@tailwindcss/typography": "^0.5.3",
"@tricoteuses/assemblee": "^1.8.0",
"@types/eslint": "^9.6.1",
"@types/fs-extra": "^11.0.1",
"@types/he": "^1.1.2",
"@types/jsdom": "^21.1.3",
"@types/morgan": "^1.9.4",
"@types/object-hash": "^3.0.6",
"@types/papaparse": "^5.3.7",
"@typescript-eslint/eslint-plugin": "^7.6.0",
"@typescript-eslint/parser": "^7.6.0",
"augmented-data-viewer": "^0.4.4",
"autoprefixer": "^10.4.7",
"daisyui": "^4.4.22",
"dotenv": "^16.0.1",
"eslint": "^8.57.0",
"eslint": "^9.10.0",
"eslint-config-prettier": "^9.0.0",
"eslint-plugin-import": "^2.29.1",
"eslint-plugin-svelte": "^2.28.0",
"fs-extra": "^11.1.0",
"globals": "^15.9.0",
"iconify-icon": "^2.0.0",
"metslesliens": "git+https://git.en-root.org/eraviart/metslesliens.git",
"morgan": "^1.10.0",
"object-hash": "^3.0.0",
"papaparse": "^5.3.2",
"postcss": "^8.4.14",
"postcss-load-config": "^6.0.1",
"postgres": "^3.2.4",
"prettier": "^3.0.0",
"prettier-plugin-svelte": "^3.0.3",
"prettier-plugin-tailwindcss": "^0.6.5",
"sade": "^1.8.1",
"svelte-check": "^3.0.3",
"svelte-check": "^4.0.2",
"svelte2tsx": "^0.7.6",
"tailwindcss": "^3.1.5",
"tslib": "^2.3.1",
"tsx": "^4.0.0",
"typescript": "^5.0.4",
"typescript-eslint": "^8.5.0",
"vite": "^5.0.10",
"zx": "^7.1.1"
"zx": "^8.1.6"
},
"peerDependencies": {
"@sveltejs/kit": "^2.0.4",

View file

@ -1,13 +0,0 @@
const tailwindcss = require("tailwindcss")
const autoprefixer = require("autoprefixer")
const config = {
plugins: [
// Some plugins, like tailwindcss/nesting, need to run before Tailwind,
tailwindcss(),
// But others, like autoprefixer, need to run after,
autoprefixer,
],
}
module.exports = config

6
postcss.config.js Normal file
View file

@ -0,0 +1,6 @@
export default {
plugins: {
autoprefixer: {},
tailwindcss: {},
},
}

View file

@ -1,6 +0,0 @@
module.exports = {
overrides: [{ files: "*.svelte", options: { parser: "svelte" } }],
plugins: ["prettier-plugin-svelte"],
semi: false,
trailingComma: "all",
}

View file

@ -11,7 +11,7 @@ const config = {
// Consult https://kit.svelte.dev/docs/integrations#preprocessors
// for more information about preprocessors
preprocess: [vitePreprocess({})],
preprocess: vitePreprocess(),
}
export default config

View file

@ -1,8 +1,8 @@
const daisyui = require("daisyui")
const typography = require("@tailwindcss/typography")
import daisyui from "daisyui"
import typography from "@tailwindcss/typography"
import type { Config } from "tailwindcss"
/** @type {import('tailwindcss').Config}*/
const config = {
const config: Config = {
content: [
"./src/**/*.{html,js,svelte,ts}",
"./node_modules/@tricoteuses/explorer-tools/**/*.{html,js,svelte,ts}",
@ -16,4 +16,4 @@ const config = {
},
}
module.exports = config
export default config

View file

@ -5,12 +5,14 @@
"checkJs": true,
"esModuleInterop": true,
"forceConsistentCasingInFileNames": true,
"moduleResolution": "bundler",
"resolveJsonModule": true,
"skipLibCheck": true,
"sourceMap": true,
"strict": true
}
// Path aliases are handled by https://kit.svelte.dev/docs/configuration#alias
// except $lib which is handled by https://kit.svelte.dev/docs/configuration#files
//
// If you want to overwrite includes/excludes, make sure to copy over the relevant includes/excludes
// from the referenced tsconfig.json - TypeScript does not merge them in