UNPKG

@sveltek/eslint-config

Version:
122 lines (117 loc) 2.75 kB
import globals from "globals"; import jsPlugin from "@eslint/js"; import tsParser from "@typescript-eslint/parser"; import tsPlugin from "@typescript-eslint/eslint-plugin"; import sveltePlugin from "eslint-plugin-svelte"; import svelteParser from "svelte-eslint-parser"; import { defineConfig, globalIgnores } from "eslint/config"; //#region src/js/index.js const jsConfig = { files: ["**/*.{js,mjs,cjs}"], languageOptions: { ecmaVersion: "latest", sourceType: "module", globals: { ...globals.es2021, ...globals.browser, ...globals.nodeBuiltin } }, rules: { ...jsPlugin.configs.recommended.rules, "no-unused-vars": ["error", { ignoreRestSiblings: true }], "no-empty": ["error", { allowEmptyCatch: true }] } }; //#endregion //#region src/ts/index.js const tsConfig = { files: ["**/*.{ts,mts,cts}"], languageOptions: { ecmaVersion: "latest", sourceType: "module", parser: tsParser, globals: { ...globals.es2021, ...globals.browser, ...globals.nodeBuiltin } }, plugins: { "@typescript-eslint": tsPlugin }, rules: { ...jsPlugin.configs.recommended.rules, ...tsPlugin.configs.recommended.rules, "no-undef": "off", "no-empty": ["error", { allowEmptyCatch: true }], "@typescript-eslint/no-explicit-any": "off", "@typescript-eslint/no-unused-vars": ["error", { ignoreRestSiblings: true }] } }; //#endregion //#region src/svelte/index.js const svelteConfig = { files: ["**/*.svelte"], languageOptions: { sourceType: "module", ecmaVersion: "latest", parser: svelteParser, parserOptions: { parser: tsParser }, globals: { ...globals.es2021, ...globals.browser, ...globals.nodeBuiltin } }, plugins: { svelte: sveltePlugin, "@typescript-eslint": tsPlugin }, rules: { ...jsPlugin.configs.recommended.rules, ...tsPlugin.configs.recommended.rules, ...sveltePlugin.configs.recommended.at(-1).rules, "no-undef": "off", "@typescript-eslint/no-explicit-any": "off", "@typescript-eslint/no-unused-vars": ["error", { ignoreRestSiblings: true }] } }; //#endregion //#region src/ignores/index.js const ignores = [ "**/.git/", "**/.private/", "**/.build/", "**/.coverage/", "**/.history/", "**/.output/", "**/.cache/", "**/.temp/", "**/.tmp/", "**/.out/", "**/.svelte-kit/", "**/.vercel/", "**/.netlify/", "**/.next/", "**/.nuxt/", "**/node_modules/", "**/dist/", "**/build/", "**/coverage/", "**/functions/", "**/public/", "**/output/", "**/cache/", "**/temp/", "**/tmp/", "**/out/", "**/.DS_Store", "**/.env*", "**/*-lock.*", "**/*.lock", "**/*.log*", "**/*.min.*", "**/*.d.ts" ]; const ignoresConfig = { ignores }; //#endregion export { defineConfig, globalIgnores, ignores, ignoresConfig, jsConfig, svelteConfig, tsConfig };