Package Exports
- eslint-config-xaxa
- eslint-config-xaxa/package.json
Readme
eslint-config-xaxa
The ultimate ESLint config - successor to Airbnb Config. Written in and published as TypeScript. Built on Anthony Fu's ESLint config, Airbnb, ESLint Stylistic, Perfectionist, React, TypeScript, Astro, JSDocs, Prettier, Node.js, Unicorns, Promises, and more.
Install
Keep in mind that this package is written and published as TypeScript,
so you need to use eslint.config.ts
and add jiti
to your devDependencies.
npm install --save-dev eslint eslint-config-xaxa jiti
Usage
Create a file named eslint.config.ts
in the root of your project and add the following code:
import xaxa from 'eslint-config-xaxa';
// You can pass `OptionsXaxa` in the first argument,
// and user eslint config in the next arguments
export default xaxa({
// jsx: true, // Enable only JSX, enabled when react is true
// type: 'lib', // default is 'lib', can be 'app'
// typescript: true, // auto-detected and enabled
// airbnb: {
// // Airbnb overrides, check the options below
// },
// pnpm: true, // Enable pnpm support, auto-detected and enabled based on existence of `pnpm-lock.yaml`
react: true, // Enable React rules + JSX
semi: false // Disable semi-colons, default is true
});
Options
Full list of options can be found below. If you want to override anything, you can by passing an object instead of boolean, and follow the intellisense hints.
export interface OptionsXaxa {
/**
* Enable detection to disable auto-fixes of 3 rules, for developer experience.
* @default true
*/
isInEditor?: boolean;
/**
* Extend the default Airbnb Base ESLint config with rules and other settings.
*/
airbnb?: OptionsAirbnb;
/**
* Enable Astro support.
*
* @default false
*/
astro?: boolean | TypedFlatConfigItem['rules'];
/**
* Enable the ESLint's JS recommended preset (@eslint/js/recommended)
* @default true
*/
eslintJsRecommended?: boolean;
/**
* Enable auto-renaming of plugins
* @default true
*/
autoRenamePlugins?: boolean;
/**
* Enable component extensions
*/
componentExts?: string[];
/**
* Enable gitignore support.
*
* Passing an object to configure the options.
*
* @see https://github.com/antfu/eslint-config-flat-gitignore
* @default true
*/
gitignore?: boolean | FlatGitignoreOptions;
/**
* User ignores
*/
ignores?: string[];
/**
* Enable JSX support
* @default false
*/
jsx?: boolean;
/**
* Enable linting for **code snippets** in Markdown.
*
* For formatting Markdown content, enable also `formatters.markdown`.
*
* @default true
*/
markdown?: boolean | TypedFlatConfigItem['rules'];
/**
* Enable Node support
* @default true
*/
node?: boolean | TypedFlatConfigItem['rules'];
/**
* Enable Perfectionist support
* @default true
*/
perfectionist?: boolean | TypedFlatConfigItem['rules'];
/**
* Enable pnpm (workspace/catalogs) support.
* See `src/utils.ts isPnpm`
*
* @default auto-detect based on existence `pnpm-lock.yaml`
*/
pnpm?: boolean;
/**
* Enable Promise support
* @default true
*/
promise?: boolean | TypedFlatConfigItem['rules'];
/**
* Enable react rules.
*
* @default false
*/
react?: boolean | TypedFlatConfigItem['rules'];
/**
* Enable regexp rules.
*
* @see https://ota-meshi.github.io/eslint-plugin-regexp/
* @default true
*/
regexp?: boolean | (OptionsRegExp & OptionsOverrides);
/**
* Enable semi-colon support
* @default true
*/
semi?: boolean;
/**
* Package type (lib or app)
* @default 'lib'
*/
type?: 'lib' | 'app';
/**
* Enable TypeScript support.
*
* Passing an object to enable TypeScript Language Server support.
*
* @default auto-detect based on the dependencies
*/
typescript?: boolean | OptionsTypescript;
/**
* Enable Unicorn support
* @default true
*/
unicorn?: boolean | TypedFlatConfigItem['rules'];
/**
* Enable WGW support
* @default true
*/
wgw?: boolean | TypedFlatConfigItem['rules'];
/**
* Enable stylistic rules. Defaults to `semi: true`, `quote: 'single'` and `indent: 2` (spaces)
*
* @see https://eslint.style/
* @default true
*/
stylistic?: boolean | (StylisticConfig & OptionsOverrides);
/**
* Enable JSONC support
* @default true
*/
jsonc?: boolean | TypedFlatConfigItem['rules'];
/**
* Enable YAML support
* @default true
*/
yaml?: boolean | TypedFlatConfigItem['rules'];
/**
* Enable TOML support
* @default true
*/
toml?: boolean | TypedFlatConfigItem['rules'];
/**
* Use external formatters to format files.
*
* When set to `true`, it will enable all formatters.
*
* @default false
*/
formatters?: boolean | OptionsFormatters;
}