Skip to content

LLM Resources

@dovenv/eslint-config - API documentation โ€‹

Functions โ€‹

experimental__eslintEncreasePerformance() โ€‹

ts
function experimental__eslintEncreasePerformance(config: Config[]): Config[]

Enhances ESLint configuration performance by modifying file patterns and rules based on specific conditions.

Parameters โ€‹

ParameterTypeDescription
configConfig[]An array of ESLint configuration objects to be processed.

Returns โ€‹

Config[]

The modified configuration array.


includeGitIgnore() โ€‹

ts
function includeGitIgnore(gitIgnorePath?: string): Config

Include the contents of a .gitignore file in ESLint's ignore configuration.

Parameters โ€‹

ParameterTypeDescription
gitIgnorePath?stringThe path to the .gitignore file. If not provided, the .gitignore file in the current working directory will be used.

Returns โ€‹

Config

An object that ESLint can use to ignore files.


setConfig() โ€‹

ts
function setConfig(props: Partial<ConfigParams>, callback?: (config: Config[]) => Config[]): Config[]

Set all eslint config at once.

Parameters โ€‹

ParameterTypeDescription
propsPartial<ConfigParams>List of config to enable.
callback?(config: Config[]) => Config[]If provided, the config will be passed to the callback, and the returned value will be used instead of the default config.

Returns โ€‹

Config[]

  • The list of config.

setCssConfig() โ€‹

ts
function setCssConfig(params?: CssConfigParams): Config[]

Generates a CSS ESLint config based on the given parameters.

Parameters โ€‹

ParameterTypeDescription
params?CssConfigParamsParameters to generate the config.

Returns โ€‹

Config[]

  • The generated CSS ESLint config.

Example โ€‹

ts
// Generates a basic CSS ESLint config.
const config = setCssConfig()

// Generates a CSS ESLint config with tailwind syntax.
const config = setCssConfig({ tailwind: true })

// Generates a CSS ESLint config with postcss syntax.
const config = setCssConfig({ postcss: true })

// Generates a CSS ESLint config with custom rules.
const config = setCssConfig({
  rules: {
  },
})

setHtmlConfig() โ€‹

ts
function setHtmlConfig(params?: ConfigParamsSuper): Config[]

Set HTML ESLint config.

Generates an HTML ESLint config based on the given parameters.

Parameters โ€‹

ParameterTypeDescription
params?ConfigParamsSuperCustom rules to apply.

Returns โ€‹

Config[]

  • The generated HTML ESLint config.

See โ€‹

https://html-eslint.org/docs/rules

Example โ€‹

ts
// Generates a basic HTML ESLint config.
const config = setHtmlConfig()

// Generates an HTML ESLint config with custom rules.
const config = setHtmlConfig({
  rules: {
    '@html-eslint/indent' : [ 'error', 'tab' ],
    '@html-eslint/sort-attrs' : [ 'error' ],
    // ... other rules
  },
})

setIgnoreConfig() โ€‹

ts
function setIgnoreConfig(paths: string[]): Config

Set paths to ignore in ESLint.

Parameters โ€‹

ParameterTypeDescription
pathsstring[]An array of paths to ignore.

Returns โ€‹

Config

  • An object with a single property, ignores, that is an array of paths to ignore.

Example โ€‹

ts
const config = setIgnoreConfig( [
 './static/*',
	'./public/*',
])

setJsConfig() โ€‹

ts
function setJsConfig(params?: ConfigParamsSuper): Config[]

Generates a JS ESLint config based on the given parameters.

Parameters โ€‹

ParameterTypeDescription
params?ConfigParamsSuperParameters to customize the config.

Returns โ€‹

Config[]

  • The generated JS ESLint config.

Example โ€‹

ts
// Generates a basic JS ESLint config.
const config = setJsConfig()

// Generates a JS ESLint config with custom rules.
const config = setJsConfig({
  rules: {
  },
})

setJSDocConfig() โ€‹

ts
function setJSDocConfig(params?: JSDocConfigParmas): Config[]

Generates a JSDoc ESLint config based on the given parameters.

Parameters โ€‹

ParameterTypeDescription
params?JSDocConfigParmasParameters to generate the config.

Returns โ€‹

Config[]

  • The generated JSDoc ESLint config.

See โ€‹

https://github.com/gajus/eslint-plugin-jsdoc

Example โ€‹

ts
// Generates a basic JSDoc ESLint config.
const config = setJSDocConfig()

// Generates a JSDoc ESLint config with custom rules.
const config = setJSDocConfig({
  rules: {
    'jsdoc/no-types' : [ 'error' ],
  },
})

setJsonConfig() โ€‹

ts
function setJsonConfig(params?: ConfigParamsSuper): Config[]

Generates a JSON ESLint config based on the given parameters.

Parameters โ€‹

ParameterTypeDescription
params?ConfigParamsSuperParameters to customize the JSON rules.

Returns โ€‹

Config[]

  • The generated JSON ESLint config.

See โ€‹

https://ota-meshi.github.io/eslint-plugin-jsonc/user-guide/

Example โ€‹

ts
// Generates a basic JSON ESLint config.
const config = setJsonConfig()

// Generates a JSON ESLint config with custom rules.
const config = setJsonConfig({
  rules: {
    'jsonc/no-dupe-keys': ['error'],
  },
})

setMdConfig() โ€‹

ts
function setMdConfig(params?: ConfigParamsSuper): Config[]

Defines a configuration object for the dovenv markdown plugin.

Parameters โ€‹

ParameterTypeDescription
params?ConfigParamsSuperThe configuration object.

Returns โ€‹

Config[]

The defined configuration object. The default configuration is based on the recommended configuration for the eslint-plugin-markdownlint plugin. You can override any of these rules by passing them as part of the rules object in the params object.

Example โ€‹

ts
export default setMdConfig( {
	rules: {
		'markdownlint/md013' : 'error', // line length
		'markdownlint/md024' : 'error', // Multiple headers with the same content
	},
} )

setPackageJsonConfig() โ€‹

ts
function setPackageJsonConfig(params?: ConfigParamsSuper): Config[]

Generates a package.json ESLint config based on the given parameters.

Parameters โ€‹

ParameterTypeDescription
params?ConfigParamsSuperParameters to customize the config.

Returns โ€‹

Config[]

  • The generated package.json ESLint config.

See โ€‹

https://ota-meshi.github.io/eslint-plugin-package-json

Example โ€‹

ts
// Generates a basic package.json ESLint config.
const config = setPackageJsonConfig()

// Generates a package.json ESLint config with custom rules.
const config = setPackageJsonConfig({
  rules: {
    'package-json/require-version' : 'error',
  },
})

setPlaywrightConfig() โ€‹

ts
function setPlaywrightConfig(params?: PlaywrightConfigParams): Config[]

Generates a Playwright ESLint config based on the given parameters.

Parameters โ€‹

ParameterTypeDescription
params?PlaywrightConfigParamsOptional parameters to customize the config.

Returns โ€‹

Config[]

  • The generated Playwright ESLint config.

See โ€‹

https://www.npmjs.com/package/eslint-plugin-playwright

Example โ€‹

ts
// Generates a basic Playwright ESLint config.
const config = setPlaywrightConfig()

// Generates a Playwright ESLint config with custom rules.
const config = setPlaywrightConfig({
  rules: {
    'playwright/no-focused-tests': 'error',
  },
})

setSchemaConfig() โ€‹

ts
function setSchemaConfig(): Config[]

Generates a JSON Schema ESLint config based on the given parameters.

Returns โ€‹

Config[]

  • The generated JSON Schema ESLint config.

See โ€‹

https://ota-meshi.github.io/eslint-plugin-json-schema-validator

Example โ€‹

ts
// Generates a basic JSON Schema ESLint config.
const config = setSchemaConfig()

setSvelteConfig() โ€‹

ts
function setSvelteConfig(params?: Partial<SvelteParams>): Promise<Config[]>

SET SVELTE ESLINT CONFIG.

Creates a config for svelte.

Parameters โ€‹

ParameterTypeDescription
params?Partial<SvelteParams>Parameters.

Returns โ€‹

Promise<Config[]>

A list of configurations.

See โ€‹

https://sveltejs.github.io/eslint-plugin-svelte/


setTomlConfig() โ€‹

ts
function setTomlConfig(params?: ConfigParamsSuper): Config[]

Generates a TOML ESLint config based on the given parameters.

Parameters โ€‹

ParameterTypeDescription
params?ConfigParamsSuperParameters to customize the config.

Returns โ€‹

Config[]

  • The generated TOML ESLint config.

Example โ€‹

ts
// Generates a basic TOML ESLint config.
const config = setTomlConfig()

// Generates a TOML ESLint config with custom rules.
const config = setTomlConfig({
  rules: {
    'toml/no-empty-tables': ['error'],
    'toml/no-inline-tables': ['warn'],
  },
})

setTsConfig() โ€‹

ts
function setTsConfig(params?: ConfigParamsSuper): Config[]

Generates a TypeScript ESLint config based on the given parameters.

Parameters โ€‹

ParameterTypeDescription
params?ConfigParamsSuperParameters to customize the config.

Returns โ€‹

Config[]

  • The generated TypeScript ESLint config.

See โ€‹

https://github.com/typescript-eslint/typescript-eslint/tree/master/packages/eslint-plugin#recommended

Example โ€‹

ts
// Generates a basic TypeScript ESLint config.
const config = setTsConfig()

// Generates a TypeScript ESLint config with custom rules.
const config = setTsConfig({
  rules: {
  },
})

setTsConfigDir() โ€‹

ts
function setTsConfigDir(tsconfigRootDir: string): Config

Parameters โ€‹

ParameterType
tsconfigRootDirstring

Returns โ€‹

Config


setVueConfig() โ€‹

ts
function setVueConfig(): Config[]

Generates an ESLint configuration for Vue.js files.

This configuration extends the 'flat/strongly-recommended' rules from eslint-plugin-vue and applies specific rules for Vue files.

Returns โ€‹

Config[]

An array of configuration objects for Vue.js linting.

See โ€‹

https://www.npmjs.com/package/eslint-plugin-vue


setYamlConfig() โ€‹

ts
function setYamlConfig(params?: ConfigParamsSuper): Config[]

Generates a YAML ESLint config based on the given parameters.

Parameters โ€‹

ParameterTypeDescription
params?ConfigParamsSuperParameters to customize the config.

Returns โ€‹

Config[]

  • The generated YAML ESLint config.

See โ€‹

https://ota-meshi.github.io/eslint-plugin-yml/

Example โ€‹

ts
// Generates a basic YAML ESLint config.
const config = setYamlConfig()

// Generates a YAML ESLint config with custom rules.
const config = setYamlConfig({
  rules: {
    'yml/require-string-key' : [ 'error' ],
  },
})

Type Aliases โ€‹

ConfigParams โ€‹

ts
type ConfigParams: {
  css: boolean;
  general: "ts" | "js";
  gitignore: boolean | string;
  html: boolean;
  ignore: string[];
  jsdoc: boolean;
  json: boolean;
  md: boolean;
  package: boolean;
  playwright: boolean | Parameters<typeof setPlaywrightConfig>[0];
  schema: boolean;
  toml: boolean;
  vue: boolean;
  yaml: boolean;
};

Type declaration โ€‹

NameTypeDescription
cssboolean-
general"ts" | "js"Default 'js'
gitignoreboolean | stringIgnore files from gitignore. If a string is provided, it will be used as the path to the .gitignore file. Default false
htmlboolean-
ignorestring[]Ignore files from a list.
jsdocboolean-
jsonboolean-
mdboolean-
packageboolean-
playwrightboolean | Parameters<typeof setPlaywrightConfig>[0]-
schemaboolean-
tomlboolean-
vueboolean-
yamlboolean-

References โ€‹

default โ€‹

Renames and re-exports config

Variables โ€‹

config โ€‹

ts
const config: Config[];

Default dovenv eslint config.

Includes:

  • jsConfig
  • tsConfig
  • jsdocConfig
  • htmlConfig
  • mdConfig
  • yamlConfig
  • jsonConfig
  • packageJsonConfig
  • tomlConfig.

cssConfig โ€‹

ts
const cssConfig: Config[];

CSS Eslint config.

See โ€‹

https://github.com/eslint/css


FILES โ€‹

ts
const FILES: {
  COMMON: '**/*.{cjs,cts}';
  CSS: '**/*.css';
  ESM: '**/*.{mjs,mts}';
  HTML: '**/*.html';
  JS: '**/*.{js,jsx,cjs,mjs}';
  JSON: '**/*.{json,json5,jsonc}';
  MARKDOWN: '**/*.md';
  PACKAGEJSON: '**/package.json';
  SVELTE: '**/*.svelte';
  SVELTE_FILE: '**/*.svelte.{js,cjs,mjs,ts,cts,mts}';
  TEST_E2E: 'tests/**/*.{js,jsx,cjs,mjs,ts,tsx,cts,mts}';
  TEST_UNIT: '**/*.{spec,test}.{js,jsx,cjs,mjs,ts,tsx,cts,mts}';
  TOML: '**/*.{toml,tml}';
  TS: '**/*.{ts,tsx,cts,mts}';
  VUE: '**/*.vue';
  YAML: '**/*.{yaml,yml}';
};

Constant for file patterns.

Type declaration โ€‹

NameTypeDefault value
COMMON"**/*.{cjs,cts}"'**/*.{cjs,cts}'
CSS"**/*.css"'**/*.css'
ESM"**/*.{mjs,mts}"'**/*.{mjs,mts}'
HTML"**/*.html"'**/*.html'
JS"**/*.{js,jsx,cjs,mjs}"'**/*.{js,jsx,cjs,mjs}'
JSON"**/*.{json,json5,jsonc}"'**/*.{json,json5,jsonc}'
MARKDOWN"**/*.md"'**/*.md'
PACKAGEJSON"**/package.json"'**/package.json'
SVELTE"**/*.svelte"'**/*.svelte'
SVELTE_FILE"**/*.svelte.{js,cjs,mjs,ts,cts,mts}"'**/*.svelte.{js,cjs,mjs,ts,cts,mts}'
TEST_E2E"tests/**/*.{js,jsx,cjs,mjs,ts,tsx,cts,mts}"'tests/**/*.{js,jsx,cjs,mjs,ts,tsx,cts,mts}'
TEST_UNIT"**/*.{spec,test}.{js,jsx,cjs,mjs,ts,tsx,cts,mts}"'**/*.{spec,test}.{js,jsx,cjs,mjs,ts,tsx,cts,mts}'
TOML"**/*.{toml,tml}"'**/*.{toml,tml}'
TS"**/*.{ts,tsx,cts,mts}"'**/*.{ts,tsx,cts,mts}'
VUE"**/*.vue"'**/*.vue'
YAML"**/*.{yaml,yml}"'**/*.{yaml,yml}'

htmlConfig โ€‹

ts
const htmlConfig: Config[];

HTML Eslint config.

See โ€‹

https://html-eslint.org/docs/rules


jsConfig โ€‹

ts
const jsConfig: Config[];

JS CONFIG FILE.

See โ€‹

https://eslint.org/docs/user-guide/configuring


jsdocConfig โ€‹

ts
const jsdocConfig: Config[];

JSDOC Eslint config.

See โ€‹

https://github.com/gajus/eslint-plugin-jsdoc#readme


jsonConfig โ€‹

ts
const jsonConfig: Config[];

JSON ESLINT CONFIG.

See โ€‹

https://ota-meshi.github.io/eslint-plugin-jsonc/user-guide/


mdConfig โ€‹

ts
const mdConfig: Config[];

MARKDOWN eslint config.

See โ€‹

https://gitlab.com/pawelbbdrozd/eslint-plugin-markdownlint


packageJsonConfig โ€‹

ts
const packageJsonConfig: Config[];

PACKAGE JSON ESLINT CONFIG.

See โ€‹

https://github.com/JoshuaKGoldberg/eslint-plugin-package-json#readme


playwrightConfig โ€‹

ts
const playwrightConfig: Config[];

PLAYWRIGHT ESLINT CONFIG.

See โ€‹

https://www.npmjs.com/package/eslint-plugin-playwright


schemaConfig โ€‹

ts
const schemaConfig: Config[];

SCHEMA ESLINT CONFIG.

See โ€‹

https://ota-meshi.github.io/eslint-plugin-json-schema-validator


tomlConfig โ€‹

ts
const tomlConfig: Config[];

TOML ESLINT CONFIG.

See โ€‹

https://www.npmjs.com/package/eslint-plugin-toml


tsConfig โ€‹

ts
const tsConfig: Config[];

TYPESCRIPT (TS).

Includes: jsConfig.

See โ€‹

https://typescript-eslint.io/getting-started/


vueConfig โ€‹

ts
const vueConfig: Config[];

VUE ESLINT CONFIG.

See โ€‹

https://www.npmjs.com/package/eslint-plugin-vue


yamlConfig โ€‹

ts
const yamlConfig: Config[];

YAML ESLINT CONFIG.

See โ€‹

https://ota-meshi.github.io/eslint-plugin-yml/