ESLint shareable config for XO with support for JavaScript, TypeScript, HTML, and Markdown
This is for advanced users. You probably want to use XO directly.
Use the XO issue tracker instead of this one.
npm install --save-dev eslint-config-xo// eslint.config.js
import eslintConfigXo from 'eslint-config-xo';
export default [
...eslintConfigXo(),
];Type: boolean
Default: false
Use browser globals instead of Node.js globals.
export default [
...eslintConfigXo({browser: true}),
];Type: boolean | number
Default: false
Use spaces for indentation instead of tabs. Set to true for 2 spaces, or a number for a custom count.
export default [
...eslintConfigXo({space: true}),
];Type: boolean
Default: true
Use semicolons at the end of statements. Set to false to enforce no semicolons.
export default [
...eslintConfigXo({semicolon: false}),
];TypeScript is supported out of the box. If typescript is installed, TypeScript rules are automatically enabled. For JavaScript-only projects, typescript is not required.
HTML files (*.html) are linted automatically using @html-eslint/eslint-plugin, covering best practices, accessibility, SEO, and style.
Markdown files (*.md) are linted automatically using @eslint/markdown, covering link/image correctness, heading structure, and more.
eslint-plugin-unicorneslint-plugin-import-xeslint-plugin-neslint-plugin-ava@eslint-community/eslint-plugin-eslint-comments@stylistic/eslint-plugintypescript-eslint@html-eslint/eslint-plugin@eslint/markdowneslint-plugin-regexpeslint-plugin-jsdoc
XO is an ESLint wrapper with great defaults.
Here are some reason why you should use the XO CLI instead of this config:
- XO comes bundled with this config.
- Beautiful output.
- No need to specify file paths to lint. It will lint all JS files except commonly ignored paths.
- Super simple to add XO to a project with
$ npm init xo. - Config/rule overrides per files/globs.
- Prettier integration.
- React support.
- Can open all files with errors at the correct line in your editor. (See the
--openflag) - The editor plugins are IMHO better than the ESLint ones. (Subjective)
tl;dr You miss out on a lot by just using this config.
- eslint-config-xo-react - ESLint shareable config for React to be used with this config