@tresjs/eslint-config
Version:
Opinionated ESLint configuration for Tres.js ecosystem
107 lines (102 loc) • 2.59 kB
JavaScript
// src/index.ts
import antfu from "@antfu/eslint-config";
// src/rules/antfu.ts
var antfuConfig = {
stylistic: true,
// vue: true, // autodetected by @antfu/eslint-config, no need to set a default
// typescript: true, // autodetected by @antfu/eslint-config, no need to set a default
ignores: [
"**/dist/**",
"sponsorkit/**",
"node_modules/**",
"coverage/**",
"**/public/**"
],
formatters: {
css: true,
html: true
}
};
var antfu_default = antfuConfig;
// src/rules/base.ts
var baseConfig = [
// General Rules
{
name: "tres:general",
rules: {
"curly": ["error", "all"],
"style/function-call-spacing": ["error", "never"],
"node/prefer-global/process": "off",
"antfu/top-level-function": "off",
"perfectionist/sort-imports": "off",
"style/max-statements-per-line": "off",
"jsdoc/check-alignment": "off"
}
},
// Vue Rules
{
name: "tres:vue",
files: ["**/*.vue"],
rules: {
"vue/max-attributes-per-line": ["error", {
singleline: { max: 10 },
multiline: { max: 1 }
}],
"vue/singleline-html-element-content-newline": "off",
"vue/html-self-closing": ["warn", {
html: {
void: "always",
normal: "never"
}
}],
"vue/attribute-hyphenation": "off"
}
}
];
var base_default = baseConfig;
// src/rules/nuxt.ts
var nuxtConfig = [
// Nuxt can use auto-imports, eslint should not throw errors for undefined variables.
{
name: "tres:nuxt:auto-imports",
files: ["**/*.{js,ts,jsx,tsx,vue}"],
rules: {
"no-undef": "off"
}
},
// Components should have multiple word names.
// Pages, layouts, app.* and error.* not included as they can have single word names.
{
name: "tres:nuxt:components",
files: ["**/components/**/*.{js,ts,jsx,tsx,vue}"],
rules: {
"vue/multi-word-component-names": "warn"
}
},
// Pages and layouts are required to have a single root element if transitions are enabled.
{
name: "tres:nuxt:pages-layouts",
files: ["**/{pages,layouts}/**/*.{js,ts,jsx,tsx,vue}"],
rules: {
"vue/no-multiple-template-root": "error"
}
}
];
var nuxt_default = nuxtConfig;
// src/index.ts
var tresLintConfig = (options = {}, ...configs) => {
return antfu(
// @antfu/eslint-config options, must be the first argument
{
...antfu_default,
...options
},
// Addtionals flat configs start from here
base_default,
...configs
);
};
export {
nuxt_default as nuxt,
tresLintConfig
};