Utilities & Globs
@eienjs/eslint-config exports utility functions and standard file glob constants that you can reuse in your own eslint.config.js.
Utility Functions
combine(...configs)
Resolves and flattens an arbitrary mix of single config objects, arrays of config objects, or promises into a flat Promise<TypedFlatConfigItem[]>.
import { combine } from '@eienjs/eslint-config';
import { ignores, javascript } from '@eienjs/eslint-config/configs';
export default combine(
ignores(),
javascript(),
{
rules: {
'no-console': 'off',
},
},
);
toArray(value)
Wraps a single value into an array if it is not already an array (T | T[] => T[]).
interopDefault(modulePromise)
Awaits a dynamic import() or module value and unwraps its .default export if present.
isInEditorEnv()
Returns true when ESLint is running inside a supported code editor (VS Code, JetBrains IDE, Vim, Neovim, or Zed) and not inside CI, Git hooks, or lint-staged.
isInGitHooksOrLintStaged()
Returns true when running inside Git hooks (GIT_PARAMS, VSCODE_GIT_COMMAND) or lint-staged.
isPackageInScope(name)
Checks whether a package is installed and resolvable relative to @eienjs/eslint-config.
ensurePackages(packages)
Checks whether optional packages are installed and prompts the user to install any missing ones in interactive terminals.
parserPlain
A minimal pass-through ESLint parser that produces an empty AST program, used for formatting non-JavaScript files (such as .css, .html, .xml, and .md) with eslint-plugin-format.
Glob Constants
Import glob patterns directly from @eienjs/eslint-config to target specific file types in your custom config blocks:
import { eienjs, GLOB_SRC, GLOB_TESTS } from '@eienjs/eslint-config';
export default eienjs().append({
files: [GLOB_SRC],
ignores: GLOB_TESTS,
rules: {
'no-console': 'error',
},
});
| Constant | Value |
|---|---|
GLOB_SRC_EXT | '?([cm])[jt]s?(x)' |
GLOB_SRC | '**/*.?([cm])[jt]s?(x)' |
GLOB_JS | '**/*.?([cm])js' |
GLOB_JSX | '**/*.?([cm])jsx' |
GLOB_TS | '**/*.?([cm])ts' |
GLOB_TSX | '**/*.?([cm])tsx' |
GLOB_STYLE | '**/*.{c,le,sc}ss' |
GLOB_CSS | '**/*.css' |
GLOB_POSTCSS | '**/*.{p,post}css' |
GLOB_LESS | '**/*.less' |
GLOB_SCSS | '**/*.scss' |
GLOB_JSON | '**/*.json' |
GLOB_JSON5 | '**/*.json5' |
GLOB_JSONC | '**/*.jsonc' |
GLOB_MARKDOWN | '**/*.md' |
GLOB_MARKDOWN_IN_MARKDOWN | '**/*.md/*.md' |
GLOB_MARKDOWN_CODE | '**/*.md/**/*.?([cm])[jt]s?(x)' |
GLOB_VUE | '**/*.vue' |
GLOB_YAML | '**/*.y?(a)ml' |
GLOB_TOML | '**/*.toml' |
GLOB_XML | '**/*.xml' |
GLOB_SVG | '**/*.svg' |
GLOB_HTML | '**/*.htm?(l)' |
GLOB_ASTRO | '**/*.astro' |
GLOB_ASTRO_TS | '**/*.astro/*.ts' |
GLOB_EXTS | '{js,ts,jsx,tsx,vue}' |
GLOB_TESTS | Array of __tests__, *.spec.*, *.test.*, *.bench.*, *.benchmark.* globs |
GLOB_ALL_SRC | Array of all source, style, data, and markup globs |
GLOB_EXCLUDE | Array of all default ignored directory and file globs |
