English | 中文
Front-end project eslint js/ts/node/vue/react code style specification configuration,
node>=18.18
is recommended.
- Install dependencies
pnpm add -D eslint prettier @tomjs/eslint
-
Modify the
eslint.config.{js,cjs,mjs}
configuration as needed, such as -
eslint.config.cjs
const eslint = require('@tomjs/eslint');
module.exports = [...eslint.configs.ts];
eslint.config.mjs
import eslint from '@tomjs/eslint/ts';
export default [...eslint];
- Supports
ts
,js
,node
,node/js
,vue
,vue/js
,vue2
,vue2/js
,react
,react/js
、browser
、browser/js
configurations.
node
project configuration, inherits ts
Modify eslint.config.cjs
configuration, such as
const eslint = require('@tomjs/eslint');
module.exports = [...eslint.configs.node];
vue
project configuration, inherits ts
Modify eslint.config.cjs
configuration, such as
const eslint = require('@tomjs/eslint');
module.exports = [...eslint.configs.vue];
react
project configuration, inherits ts
Modify eslint.config.cjs
configuration, such as
const eslint = require('@tomjs/eslint');
module.exports = [...eslint.configs.react];
@tomjs/eslint | eslint | node |
---|---|---|
>=4 | ^9.7.0 | ^18.18.0 || ^20.9.0 || >=21.1.0 |
3 | ^8.7.0 | ^18.18.0 || >=20.0.0 |