@jimmy.codes/eslint-config
Version:
A simple, modern ESLint config that covers most use cases.
71 lines (70 loc) • 2.12 kB
JavaScript
import { GLOB_ASTRO } from "./globs.mjs";
import { n as extractOptions, t as unwrapDefault } from "./interop-default-CAdBatTA.mjs";
import { t as rebrand } from "./rebrand-h7fk1Gdd.mjs";
import globals from "globals";
//#region src/configs/astro.ts
async function astroConfig(options) {
const extractedOptions = extractOptions(options);
const files = [GLOB_ASTRO];
const [tsPlugin, astroPlugin, astroParser, jsxA11yPlugin] = await Promise.all([
import("typescript-eslint"),
import("eslint-plugin-astro"),
import("astro-eslint-parser"),
unwrapDefault(import("eslint-plugin-jsx-a11y-x"))
]);
return [
{
files,
languageOptions: {
globals: {
...globals.node,
Astro: false,
Fragment: false
},
parser: astroParser,
parserOptions: {
extraFileExtensions: [".astro"],
parser: tsPlugin.parser
},
sourceType: "module"
},
name: "jimmy.codes/astro",
plugins: {
"astro": astroPlugin,
"jsx-a11y": jsxA11yPlugin
},
processor: "astro/client-side-ts",
rules: {
...rebrand(jsxA11yPlugin.configs.recommended.rules, "jsx-a11y-x", "jsx-a11y"),
"astro/missing-client-only-directive-value": "error",
"astro/no-conflict-set-directives": "error",
"astro/no-deprecated-astro-canonicalurl": "error",
"astro/no-deprecated-astro-fetchcontent": "error",
"astro/no-deprecated-astro-resolve": "error",
"astro/no-deprecated-getentrybyslug": "error",
"astro/no-exports-from-components": "off",
"astro/no-prerender-export-outside-pages": "error",
"astro/no-unsafe-inline-scripts": "error",
"astro/no-unused-define-vars-in-style": "error",
"astro/valid-compile": "error",
...extractedOptions?.overrides
}
},
{
files,
languageOptions: { parserOptions: {
program: null,
project: false,
projectService: false
} },
name: "jimmy.codes/astro/disable-type-checked",
rules: tsPlugin.configs.disableTypeChecked.rules
},
{
name: "jimmy.codes/astro/imports",
settings: { "import-x/core-modules": ["astro:content"] }
}
];
}
//#endregion
export { astroConfig as default };