Skip to content

Commit

Permalink
support flat config
Browse files Browse the repository at this point in the history
  • Loading branch information
Logicer16 committed Feb 4, 2024
1 parent 3175a75 commit 110c50a
Show file tree
Hide file tree
Showing 10 changed files with 1,114 additions and 966 deletions.
65 changes: 0 additions & 65 deletions .eslintrc.cjs

This file was deleted.

6 changes: 5 additions & 1 deletion .prettierrc.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
/**
* @file The prettier config.
*/

import logicerPrettierConfig from "@logicer/prettier-config";

/**
* @type {import('prettier').Options}
*/
const prettierConfig = {
...logicerPrettierConfig,
plugins: ["prettier-plugin-svelte", "prettier-plugin-tailwindcss"],
overrides: [{files: "*.svelte", options: {parser: "svelte"}}],
plugins: ["prettier-plugin-svelte", "prettier-plugin-tailwindcss"],
svelteStrictMode: true
};

Expand Down
107 changes: 107 additions & 0 deletions eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
/**
* @file The eslint config.
*/
/* eslint-disable @typescript-eslint/naming-convention */
import {ConfigGenerator, mergeGlobals} from "@logicer/eslint-plugin";
import globals from "globals";

const generator = new ConfigGenerator({
javascript: true,
jsdoc: true,
prettier: true,
svelte: true,
typescript: true
});

/**
* @type {import("eslint").Linter.FlatConfigFileSpec[]}
*/
const ignores = [
"node_modules/**/*",
"build/**/*",
".svelte-kit/**/*",
"package/**/*",
".type-coverage/**/*",

"**/.DS_Store",
"**/.env",
"**/.env.*",
"**/!.env.example",
"**/svelte.config.js",
"**/.eslintrc.cjs",
"**/pnpm-lock.yaml",
"**/package-lock.json",
"**/yarn.lock",
"**/vite.config.js.timestamp-*",
"**/vite.config.ts.timestamp-*",
"**/.eslint_report.json",
"**/*.tsbuildinfo",
"**/.eslintcache"
];

/**
* @type {import("eslint").Linter.FlatConfig[]}
*/
const svelteConfigs = [
{
languageOptions: {
globals: mergeGlobals(globals.browser, globals.es2017, globals.node),
parserOptions: {
ecmaVersion: 2020,
extraFileExtensions: [".svelte"],
project: ["./tsconfig.json", "./tsconfig.*.json"],
sourceType: "module"
}
}
},
{
files: ["src/**/*"],
rules: {
"import/no-unresolved": [
"error",
{
// Regex
ignore: [
"\\$app/environment",
"\\$app/forms",
"\\$app/navigation",
"\\$app/paths",
"\\$app/stores",
"\\$env/dynamic/private",
"\\$env/dynamic/public",
"\\$env/static/private",
"\\$env/static/public",
"\\$service-worker"
]
}
],
"n/no-missing-import": "off",
"n/prefer-global/process": ["error", "always"]
}
}
];

/**
* @type {import("eslint").Linter.FlatConfig[]}
*/
const config = [
{ignores},
{
settings: {
"import/parsers": {
// Temporary until https://github.com/import-js/eslint-plugin-import/pull/2829
espree: [".js", ".jsx", ".cjs", ".mjs"]
},
"import/resolver": {
typescript: {
project: ["tsconfig.json", "tsconfig.eslint.json"]
}
}
}
},
...(await generator.config),
...svelteConfigs,
...(await generator.endConfig)
];

export default config;
20 changes: 5 additions & 15 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
},
"devDependencies": {
"@floating-ui/dom": "^1.5.3",
"@logicer/eslint-plugin": "^2.3.2",
"@logicer/eslint-plugin": "^4.0.1",
"@logicer/prettier-config": "^2.0.2",
"@logicer/tsconfig": "^4.0.0",
"@primer/octicons": "^19.8.0",
Expand All @@ -32,25 +32,15 @@
"@sveltejs/adapter-static": "^2.0.3",
"@sveltejs/kit": "^1.26.0",
"@tailwindcss/forms": "^0.5.7",
"@types/eslint": "^8.56.0",
"@types/file-saver": "^2.0.7",
"@typescript-eslint/eslint-plugin": "^6.13.2",
"@typescript-eslint/parser": "^6.13.2",
"@vite-pwa/sveltekit": "^0.2.7",
"autoprefixer": "^10.4.14",
"colorjs.io": "^0.4.5",
"eslint": "^8.52.0",
"eslint-config-prettier": "^8.10.0",
"eslint": "^8.56.0",
"eslint-import-resolver-typescript": "^3.6.1",
"eslint-plugin-deprecation": "^2.0.0",
"eslint-plugin-import": "npm:eslint-plugin-i@^2.29.1",
"eslint-plugin-jsdoc": "^46.9.0",
"eslint-plugin-n": "^16.3.1",
"eslint-plugin-prettier": "^5.0.1",
"eslint-plugin-regex": "^1.10.0",
"eslint-plugin-regexp": "^2.1.2",
"eslint-plugin-svelte": "^2.34.0",
"eslint-plugin-unicorn": "^49.0.0",
"file-saver": "^2.0.5",
"globals": "^13.24.0",
"kolorist": "^1.8.0",
"postcss": "^8.4.24",
"postcss-load-config": "^4.0.1",
Expand Down Expand Up @@ -86,7 +76,7 @@
},
"homepage": "https://github.com/Logicer16/icon#readme",
"engines": {
"node": "^20.8.0",
"node": "^20.10.0",
"pnpm": ">=8.10.0"
},
"type": "module",
Expand Down
Loading

0 comments on commit 110c50a

Please sign in to comment.