./configs
Exports composable factories: createAngularConfigs, createCommonConfigs, createEnvironmentConfigs, createNodeToolingConfigs, createGlobalIgnores, createGitignoreConfigs, createImportConfigs, createJavaScriptConfigs, createJsonConfigs, createLodashConfigs, createMarkdownConfigs, createPrettierConfigs, createReactConfigs, createRegexpConfigs, createPackageJsonSortConfigs, createTsconfigSortConfigs, createTypeScriptConfigs, createTypeScriptParserOptions, getTypeScriptPresetConfigs, createUniAppConfigs, createVueConfigs, and createVueJsxConfigs; also their option types, RuntimeEnvironment, LodashPreference, and DEFAULT_IGNORE_PATTERNS.
import { defineConfig } from "eslint/config";
import { createAngularConfigs, createMarkdownConfigs } from "@fast-china/eslint-config/configs";
export default defineConfig([
...createAngularConfigs(),
...createMarkdownConfigs(),
{
name: "project/custom",
rules: {
"no-console": "warn",
},
},
]);Factories return configuration fragments without automatically providing other fragments' parsers, plugins, or scopes. Prefer complete root factories unless composition boundaries are understood.
createAngularConfigs Create
Creates Angular TypeScript, external HTML template, and inline-template configuration.
Signature
export const createAngularConfigs = ({ inlineTemplates = true, templateAccessibility = true }: AngularConfigOptions = {}): ReturnType<
typeof defineConfig
>;Example
import { createAngularConfigs } from "@fast-china/eslint-config/configs";
import { defineConfig } from "eslint/config";
export default defineConfig([
...createAngularConfigs({ inlineTemplates: true, templateAccessibility: true }),
{
name: "project/custom",
files: ["src/**/*.{js,ts,vue}"],
rules: {
"no-console": "warn",
},
},
]);Input
| Input | Type | Required / default | Description |
|---|---|---|---|
options | AngularConfigOptions | Optional; defaults to {} | Angular inline-template processing and template accessibility options. |
Returns
| Value | Type | Description |
|---|---|---|
configs | ReturnType<<br> typeof defineConfig<br>> | Flat Config array ordered by TypeScript source, then external templates. |
createCommonConfigs Create
Creates common configuration for JavaScript, TypeScript, and Vue scripts.
Signature
export const createCommonConfigs = (files: readonly string[] = GLOBS_CODE): ReturnType<typeof defineConfig>;Example
import { createCommonConfigs } from "@fast-china/eslint-config/configs";
import { defineConfig } from "eslint/config";
export default defineConfig([
...createCommonConfigs(["src/**/*.{js,ts}"]),
{
name: "project/custom",
files: ["src/**/*.{js,ts,vue}"],
rules: {
"no-console": "warn",
},
},
]);Input
| Input | Type | Required / default | Description |
|---|---|---|---|
files | readonly string[] | Optional; defaults to GLOBS_CODE | ESLint globs receiving common rules. |
Returns
| Value | Type | Description |
|---|---|---|
configs | ReturnType<typeof defineConfig> | Flat Config array with common rules and unused-disable checks. |
createEnvironmentConfigs Create
Creates runtime-environment configuration.
Signature
export const createEnvironmentConfigs = ({
environment = "browser",
files = GLOBS_CODE,
nodeFiles = GLOBS_JAVASCRIPT,
globals: projectGlobals = {},
}: EnvironmentConfigOptions = {}): ReturnType<typeof defineConfig>;Example
import { createEnvironmentConfigs } from "@fast-china/eslint-config/configs";
import { defineConfig } from "eslint/config";
export default defineConfig([
...createEnvironmentConfigs({ environment: "browser", files: ["src/**/*.ts"] }),
{
name: "project/custom",
files: ["src/**/*.{js,ts,vue}"],
rules: {
"no-console": "warn",
},
},
]);Input
| Input | Type | Required / default | Description |
|---|---|---|---|
options | EnvironmentConfigOptions | Optional; defaults to {} | Runtime environment, target files, and project globals. |
Returns
| Value | Type | Description |
|---|---|---|
configs | ReturnType<typeof defineConfig> | Flat Config array for application runtime followed by Node tooling environments. |
createNodeToolingConfigs Create
Creates final overrides for Node configuration, scripts, tests, and CLI files.
Signature
export const createNodeToolingConfigs = (nodeFiles: readonly string[] = GLOBS_JAVASCRIPT): ReturnType<typeof defineConfig>;Example
import { createNodeToolingConfigs } from "@fast-china/eslint-config/configs";
import { defineConfig } from "eslint/config";
export default defineConfig([
...createNodeToolingConfigs(),
{
name: "project/custom",
files: ["src/**/*.{js,ts,vue}"],
rules: {
"no-console": "warn",
},
},
]);Input
| Input | Type | Required / default | Description |
|---|---|---|---|
nodeFiles | readonly string[] | Optional; defaults to GLOBS_JAVASCRIPT | Enabled JavaScript/TypeScript file globs. |
Returns
| Value | Type | Description |
|---|---|---|
configs | ReturnType<typeof defineConfig> | Node tooling override array. |
createGlobalIgnores Create
Creates global ignores, appending project patterns after defaults.
Signature
export const createGlobalIgnores = (additionalPatterns: readonly string[] = []): ReturnType<typeof defineConfig>;Example
import { createGlobalIgnores } from "@fast-china/eslint-config/configs";
import { defineConfig } from "eslint/config";
export default defineConfig([
...createGlobalIgnores(["coverage/**"]),
{
name: "project/custom",
files: ["src/**/*.{js,ts,vue}"],
rules: {
"no-console": "warn",
},
},
]);Input
| Input | Type | Required / default | Description |
|---|---|---|---|
additionalPatterns | readonly string[] | Optional; defaults to [] | Additional ESLint global-ignore patterns appended to the default set. |
Returns
| Value | Type | Description |
|---|---|---|
configs | ReturnType<typeof defineConfig> | Flat Config array with one named global-ignore fragment. |
createGitignoreConfigs Create
Creates global ignores from the project's .gitignore.
Signature
export const createGitignoreConfigs = (): ReturnType<typeof defineConfig>;Example
import { createGitignoreConfigs } from "@fast-china/eslint-config/configs";
import { defineConfig } from "eslint/config";
export default defineConfig([
...createGitignoreConfigs(),
{
name: "project/custom",
files: ["src/**/*.{js,ts,vue}"],
rules: {
"no-console": "warn",
},
},
]);Input
This method has no input parameters.
Returns
| Value | Type | Description |
|---|---|---|
configs | ReturnType<typeof defineConfig> | Flat Config array containing converted .gitignore patterns. |
createImportConfigs Create
Creates module-import rules.
Signature
export const createImportConfigs = (files: readonly string[] = GLOBS_CODE): ReturnType<typeof defineConfig>;Example
import { createImportConfigs } from "@fast-china/eslint-config/configs";
import { defineConfig } from "eslint/config";
export default defineConfig([
...createImportConfigs(["src/**/*.{ts,tsx}"]),
{
name: "project/custom",
files: ["src/**/*.{js,ts,vue}"],
rules: {
"no-console": "warn",
},
},
]);Input
| Input | Type | Required / default | Description |
|---|---|---|---|
files | readonly string[] | Optional; defaults to GLOBS_CODE | ESLint globs receiving import-x recommended and local rules. |
Returns
| Value | Type | Description |
|---|---|---|
configs | ReturnType<typeof defineConfig> | Flat Config array with import-x presets and local rules. |
createJavaScriptConfigs Create
Creates JavaScript/JSX configuration.
Signature
export const createJavaScriptConfigs = (files: readonly string[] = GLOBS_JAVASCRIPT): ReturnType<typeof defineConfig>;Example
import { createJavaScriptConfigs } from "@fast-china/eslint-config/configs";
import { defineConfig } from "eslint/config";
export default defineConfig([
...createJavaScriptConfigs(["src/**/*.js"]),
{
name: "project/custom",
files: ["src/**/*.{js,ts,vue}"],
rules: {
"no-console": "warn",
},
},
]);Input
| Input | Type | Required / default | Description |
|---|---|---|---|
files | readonly string[] | Optional; defaults to GLOBS_JAVASCRIPT | ESLint globs receiving JavaScript base rules. |
Returns
| Value | Type | Description |
|---|---|---|
configs | ReturnType<typeof defineConfig> | Flat Config array with JavaScript recommended presets, local rules, and JSX parsing. |
createJsonConfigs Create
Creates JSON, JSONC, and JSON5 configuration.
Signature
export const createJsonConfigs = (): ReturnType<typeof defineConfig>;Example
import { createJsonConfigs } from "@fast-china/eslint-config/configs";
import { defineConfig } from "eslint/config";
export default defineConfig([
...createJsonConfigs(),
{
name: "project/custom",
files: ["src/**/*.{js,ts,vue}"],
rules: {
"no-console": "warn",
},
},
]);Input
This method has no input parameters.
Returns
| Value | Type | Description |
|---|---|---|
configs | ReturnType<typeof defineConfig> | Flat Config array ordered by JSON, JSONC, JSON5, then VS Code workspace overrides. |
createLodashConfigs Create
Creates Lodash static-import restrictions.
Signature
export const createLodashConfigs = (preference: LodashPreference, files: readonly string[] = GLOBS_CODE): ReturnType<typeof defineConfig>;Example
import { createLodashConfigs } from "@fast-china/eslint-config/configs";
import { defineConfig } from "eslint/config";
export default defineConfig([
...createLodashConfigs("lodash", ["src/**/*.ts"]),
{
name: "project/custom",
files: ["src/**/*.{js,ts,vue}"],
rules: {
"no-console": "warn",
},
},
]);Input
| Input | Type | Required / default | Description |
|---|---|---|---|
preference | LodashPreference | Required | The only Lodash package entry allowed in the project. |
files | readonly string[] | Optional; defaults to GLOBS_CODE | ESLint globs receiving import restrictions. |
Returns
| Value | Type | Description |
|---|---|---|
configs | ReturnType<typeof defineConfig> | Flat Config array containing the selected Lodash restrictions. |
createMarkdownConfigs Create
Creates Markdown structure and syntax checks.
Signature
export const createMarkdownConfigs = (): ReturnType<typeof defineConfig>;Example
import { createMarkdownConfigs } from "@fast-china/eslint-config/configs";
import { defineConfig } from "eslint/config";
export default defineConfig([
...createMarkdownConfigs(),
{
name: "project/custom",
files: ["src/**/*.{js,ts,vue}"],
rules: {
"no-console": "warn",
},
},
]);Input
This method has no input parameters.
Returns
| Value | Type | Description |
|---|---|---|
configs | ReturnType<typeof defineConfig> | Flat Config array containing @eslint/markdown recommended presets. |
createPrettierConfigs Create
Creates the Prettier compatibility layer.
Signature
export const createPrettierConfigs = (): ReturnType<typeof defineConfig>;Example
import { createPrettierConfigs } from "@fast-china/eslint-config/configs";
import { defineConfig } from "eslint/config";
export default defineConfig([
...createPrettierConfigs(),
{
name: "project/custom",
files: ["src/**/*.{js,ts,vue}"],
rules: {
"no-console": "warn",
},
},
]);Input
This method has no input parameters.
Returns
| Value | Type | Description |
|---|---|---|
configs | ReturnType<typeof defineConfig> | Flat Config array with a named eslint-config-prettier entry. |
createReactConfigs Create
Creates React, JSX/TSX, and Hooks configuration.
Signature
export const createReactConfigs = ({ importSource = "react", polymorphicPropName = "as", version = "detect" }: ReactConfigOptions = {}): ReturnType<
typeof defineConfig
>;Example
import { createReactConfigs } from "@fast-china/eslint-config/configs";
import { defineConfig } from "eslint/config";
export default defineConfig([
...createReactConfigs({ importSource: "react", version: "detect" }),
{
name: "project/custom",
files: ["src/**/*.{js,ts,vue}"],
rules: {
"no-console": "warn",
},
},
]);Input
| Input | Type | Required / default | Description |
|---|---|---|---|
options | ReactConfigOptions | Optional; defaults to {} | React version, runtime import source, and polymorphic component attributes. |
Returns
| Value | Type | Description |
|---|---|---|
configs | ReturnType<<br> typeof defineConfig<br>> | React JavaScript, type-aware TypeScript, and Hooks Flat Config array. |
createRegexpConfigs Create
Creates regular-expression correctness checks.
Signature
export const createRegexpConfigs = (files: readonly string[] = GLOBS_CODE): ReturnType<typeof defineConfig>;Example
import { createRegexpConfigs } from "@fast-china/eslint-config/configs";
import { defineConfig } from "eslint/config";
export default defineConfig([
...createRegexpConfigs(["src/**/*.{js,ts}"]),
{
name: "project/custom",
files: ["src/**/*.{js,ts,vue}"],
rules: {
"no-console": "warn",
},
},
]);Input
| Input | Type | Required / default | Description |
|---|---|---|---|
files | readonly string[] | Optional; defaults to GLOBS_CODE | ESLint globs receiving regular-expression rules. |
Returns
| Value | Type | Description |
|---|---|---|
configs | ReturnType<typeof defineConfig> | Flat Config array with the regexp plugin and shared rules. |
createPackageJsonSortConfigs Create
Creates package.json sorting configuration.
Signature
export const createPackageJsonSortConfigs = (): ReturnType<typeof defineConfig>;Example
import { createPackageJsonSortConfigs } from "@fast-china/eslint-config/configs";
import { defineConfig } from "eslint/config";
export default defineConfig([
...createPackageJsonSortConfigs(),
{
name: "project/custom",
files: ["src/**/*.{js,ts,vue}"],
rules: {
"no-console": "warn",
},
},
]);Input
This method has no input parameters.
Returns
| Value | Type | Description |
|---|---|---|
configs | ReturnType<typeof defineConfig> | Field-sorting Flat Config array matching only package.json. |
createTsconfigSortConfigs Create
Creates tsconfig.json sorting configuration.
Signature
export const createTsconfigSortConfigs = (): ReturnType<typeof defineConfig>;Example
import { createTsconfigSortConfigs } from "@fast-china/eslint-config/configs";
import { defineConfig } from "eslint/config";
export default defineConfig([
...createTsconfigSortConfigs(),
{
name: "project/custom",
files: ["src/**/*.{js,ts,vue}"],
rules: {
"no-console": "warn",
},
},
]);Input
This method has no input parameters.
Returns
| Value | Type | Description |
|---|---|---|
configs | ReturnType<typeof defineConfig> | Field-sorting Flat Config array matching tsconfig.json and tsconfig.*.json. |
getTypeScriptPresetConfigs Presets
Returns official common/type-aware typescript-eslint presets.
Signature
export const getTypeScriptPresetConfigs = (): Linter.Config[];Example
import { getTypeScriptPresetConfigs } from "@fast-china/eslint-config/configs";
import { defineConfig } from "eslint/config";
export default defineConfig([
...getTypeScriptPresetConfigs(),
{
name: "project/custom",
files: ["src/**/*.{js,ts,vue}"],
rules: {
"no-console": "warn",
},
},
]);Input
This method has no input parameters.
Returns
| Value | Type | Description |
|---|---|---|
configs | Linter.Config[] | ESLint core recommended rules and matching typescript-eslint presets. |
createTypeScriptParserOptions Create
Creates TypeScript parser Project Service options.
Signature
export const createTypeScriptParserOptions = (extraFileExtensions: readonly string[] = []): Linter.ParserOptions;Example
import { vueConfig } from "@fast-china/eslint-config";
import { createTypeScriptParserOptions } from "@fast-china/eslint-config/configs";
import { defineConfig } from "eslint/config";
export default defineConfig([
...vueConfig,
{
name: "project/typescript-parser",
files: ["src/**/*.ts"],
languageOptions: {
parserOptions: createTypeScriptParserOptions(`[".vue"]`),
},
},
]);Input
| Input | Type | Required / default | Description |
|---|---|---|---|
extraFileExtensions | readonly string[] | Optional; defaults to [] | Additional extensions needed by this project's TypeScript Project Service. |
Returns
| Value | Type | Description |
|---|---|---|
configs | Linter.ParserOptions | Parser options with projectService always enabled. |
createTypeScriptConfigs Create
Creates TypeScript configuration.
Signature
export const createTypeScriptConfigs = (files: readonly string[] = GLOBS_TYPESCRIPT, extraFileExtensions: readonly string[] = []): ReturnType<typeof defineConfig>;Example
import { createTypeScriptConfigs } from "@fast-china/eslint-config/configs";
import { defineConfig } from "eslint/config";
export default defineConfig([
...createTypeScriptConfigs(["src/**/*.ts"], `[".vue"]`),
{
name: "project/custom",
files: ["src/**/*.{js,ts,vue}"],
rules: {
"no-console": "warn",
},
},
]);Input
| Input | Type | Required / default | Description |
|---|---|---|---|
files | readonly string[] | Optional; defaults to GLOBS_TYPESCRIPT | ESLint globs receiving TypeScript configuration. |
extraFileExtensions | readonly string[] | Optional; defaults to [] | Additional extensions consistent with framework parsers in the same composition. |
Returns
| Value | Type | Description |
|---|---|---|
configs | ReturnType<typeof defineConfig> | Flat Config array with TypeScript presets, parser options, and local rules. |
createUniAppConfigs Create
Creates UniApp runtime and manifest adaptation.
Signature
export const createUniAppConfigs = (files: readonly string[] = GLOBS_CODE): ReturnType<typeof defineConfig>;Example
import { createUniAppConfigs } from "@fast-china/eslint-config/configs";
import { defineConfig } from "eslint/config";
export default defineConfig([
...createUniAppConfigs(["src/**/*.{ts,vue,nvue}"]),
{
name: "project/custom",
files: ["src/**/*.{js,ts,vue}"],
rules: {
"no-console": "warn",
},
},
]);Input
| Input | Type | Required / default | Description |
|---|---|---|---|
files | readonly string[] | Optional; defaults to GLOBS_CODE | Code globs receiving UniApp common globals. |
Returns
| Value | Type | Description |
|---|---|---|
configs | ReturnType<typeof defineConfig> | UniApp globals and JSON-comment compatibility configuration. |
createVueConfigs Create
Creates Vue 3 SFC configuration.
Signature
export const createVueConfigs = (files: readonly string[] = `[GLOB_VUE]`, extraFileExtensions: readonly string[] = `[".vue"]`): ReturnType<typeof defineConfig>;Example
import { createVueConfigs } from "@fast-china/eslint-config/configs";
import { defineConfig } from "eslint/config";
export default defineConfig([
...createVueConfigs(["src/**/*.vue"], `[".vue"]`),
{
name: "project/custom",
files: ["src/**/*.{js,ts,vue}"],
rules: {
"no-console": "warn",
},
},
]);Input
| Input | Type | Required / default | Description |
|---|---|---|---|
files | readonly string[] | Optional; defaults to [GLOB_VUE] | SFC globs receiving Vue parsers and rules. |
extraFileExtensions | readonly string[] | Optional; defaults to [".vue"] | Additional extensions consistent with TypeScript configuration in the same composition. |
Returns
| Value | Type | Description |
|---|---|---|
configs | ReturnType<typeof defineConfig> | Flat Config array with Vue template/script parsers, recommended presets, and local rules. |
createVueJsxConfigs Create
Creates Vue JSX/TSX component-script semantics.
Signature
export const createVueJsxConfigs = (extraFileExtensions: readonly string[] = `[".vue"]`): ReturnType<typeof defineConfig>;Example
import { createVueJsxConfigs } from "@fast-china/eslint-config/configs";
import { defineConfig } from "eslint/config";
export default defineConfig([
...createVueJsxConfigs(`[".vue"]`),
{
name: "project/custom",
files: ["src/**/*.{js,ts,vue}"],
rules: {
"no-console": "warn",
},
},
]);Input
| Input | Type | Required / default | Description |
|---|---|---|---|
extraFileExtensions | readonly string[] | Optional; defaults to [".vue"] | Additional extensions consistent with TypeScript and SFC configuration in the same composition. |
Returns
| Value | Type | Description |
|---|---|---|
configs | ReturnType<typeof defineConfig> | Flat Config array separately handling standalone Vue .jsx and .tsx components. |
