Licence
ISC
Version
0.0.2
Deps
8
Size
6 kB
Vulns
0
Weekly
0
@mozartchen/eslint-config
TODO: 基于Airbnb的一些常用的eslint配置,包括basic、react、ts
Usage
安装eslint
npm i eslint -D安装本包
npm i @mozartchen/eslint-config -D若无
eslint配置文件,则新建eslint配置文件.eslintrc.jsmodule.exports = { root: true, extends: ['@mozartchen/eslint-config'], ignorePatterns: ['dist', '.eslintrc.cjs'], }若需要使用
ts,则项目中需要配置相应的tsconfig.json文件,然后在eslint配置中将ts类型文件重载并指定ts配置入口文件地址overrides: [ { // 若使用了react,则.tsx files: ['*.ts', '*.tsx'], // 若使用了react,则引入@mozartchen/eslint-config/react extends: ['@mozartchen/eslint-config/react', '@mozartchen/eslint-config/typescript'], parserOptions: { // 指定ts配置入口文件地址 tsconfigRootDir: __dirname, tsx: true, }, }, ],设置
vscode中的默认格式化程序为eslint