Package Exports
- eslint-define-config
- eslint-define-config/src/index.js
- eslint-define-config/src/index.mjs
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (eslint-define-config) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
eslint-define-config
Provide a defineConfig function for .eslintrc.js, and a defineFlatConfig function for eslint.config.js files.
This project is written by a human and only partially automatically generated!
Some rules are even enhanced by hand!
Unfortunately, this has the disadvantage that not everything is immediately defined. For example, if a rule is not defined, it falls back to a basic definition.
However, the advantage is that you get documentation for pretty much everything in the code and usually get a direct link to the respective plugin or eslint rule. The types are also strictly typed.So if you are missing something like a rule or a plugin that should also be supported or a rule definition is e.g. out of date, feel free to open an issue or PR for it.
Installation
# add eslint and eslint-define-config to project’s dev dependencies
npm add --save-dev eslint eslint-define-config
# or
yarn add --dev eslint eslint-define-config
# or
pnpm add --save-dev eslint eslint-define-configUsage
.eslintrc.js
// @ts-check
const { defineConfig } = require('eslint-define-config');
module.exports = defineConfig({
root: true,
rules: {
// rules...
},
});Flat Config
eslint.config.js
// @ts-check
const { defineFlatConfig } = require('eslint-define-config');
module.exports = defineFlatConfig([
'eslint:recommended',
{
plugins: {
// plugins...
},
rules: {
// rules...
},
},
]);Why?
Improve your eslint configuration experience with:
- auto-suggestions
- type checking (Use
// @ts-checkat the first line in your.eslintrc.jsoreslint.config.js) - documentation
- deprecation warnings
Video
Click on the thumbnail to play the video
Credits
- Proposal Idea
- Vite and Evan You for the idea
- @antfu and his tweet