@shayanthenerd/eslint-config
Version:
A modern, flexible ESLint configuration for enforcing best practices and maintaining a consistent coding style
33 lines (32 loc) • 1.02 kB
JavaScript
import { globs } from "../helpers/globs.mjs";
import { isEnabled } from "../utils/isEnabled.mjs";
import { defaultOptions } from "../helpers/options/defaultOptions.mjs";
import { getAstroRules } from "../rules/astro.mjs";
import { mergeConfigs } from "eslint-flat-config-utils";
import { parser } from "typescript-eslint";
import eslintPluginAstro from "eslint-plugin-astro";
import * as eslintParserAstro from "astro-eslint-parser";
//#region src/configs/astro.ts
function getAstroConfig(options) {
const { astro } = options.configs;
const { overrides } = isEnabled(astro) ? astro : defaultOptions.configs.astro;
return mergeConfigs({
name: "shayanthenerd/astro",
files: [globs.astro],
plugins: { astro: eslintPluginAstro },
languageOptions: {
globals: {
Astro: "readonly",
Fragment: "readonly"
},
parser: eslintParserAstro,
parserOptions: {
parser,
extraFileExtensions: [".astro"]
}
},
rules: getAstroRules(options)
}, overrides);
}
//#endregion
export { getAstroConfig };