UNPKG

@tresjs/eslint-config

Version:

Opinionated ESLint configuration for Tres.js ecosystem

143 lines (137 loc) 4.27 kB
"use strict"; var __create = Object.create; var __defProp = Object.defineProperty; var __getOwnPropDesc = Object.getOwnPropertyDescriptor; var __getOwnPropNames = Object.getOwnPropertyNames; var __getProtoOf = Object.getPrototypeOf; var __hasOwnProp = Object.prototype.hasOwnProperty; var __export = (target, all) => { for (var name in all) __defProp(target, name, { get: all[name], enumerable: true }); }; var __copyProps = (to, from, except, desc) => { if (from && typeof from === "object" || typeof from === "function") { for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); } return to; }; var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps( // If the importer is in node compatibility mode or this is not an ESM // file that has been converted to a CommonJS file using a Babel- // compatible transform (i.e. "__esModule" has not been set), then set // "default" to the CommonJS "module.exports" for node compatibility. isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, mod )); var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); // src/index.ts var src_exports = {}; __export(src_exports, { nuxt: () => nuxt_default, tresLintConfig: () => tresLintConfig }); module.exports = __toCommonJS(src_exports); var import_eslint_config = __toESM(require("@antfu/eslint-config"), 1); // 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 (0, import_eslint_config.default)( // @antfu/eslint-config options, must be the first argument { ...antfu_default, ...options }, // Addtionals flat configs start from here base_default, ...configs ); }; // Annotate the CommonJS export names for ESM import in node: 0 && (module.exports = { nuxt, tresLintConfig });