eslint-config-xx
v2.2.5
Published
eslint config xx
Downloads
769
Maintainers
Readme
eslint-config-xx
Support js/ts/jsx/tsx/vue and export prettier config
install
npm install eslint-config-xx -D
# or yarn
yarn add eslint-config-xx -D
# or pnpm
pnpm add eslint-config-xx -Deslint config
Create eslint.config.mjs file, then add the following code
// import js from '@eslint/js';
// import globals from 'globals';
// import reactHooks from 'eslint-plugin-react-hooks';
// import reactRefresh from 'eslint-plugin-react-refresh';
import { defineConfig, globalIgnores } from "eslint/config";
import configs from "eslint-config-xx";
export default defineConfig([
globalIgnores(["dist"]),
...configs,
// {
// files: ['**/*.{js,jsx}'],
// extends: [js.configs.recommended, reactHooks.configs['recommended-latest'], reactRefresh.configs.vite],
// languageOptions: {
// ecmaVersion: 2020,
// globals: globals.browser,
// parserOptions: {
// ecmaVersion: 'latest',
// ecmaFeatures: { jsx: true },
// sourceType: 'module',
// },
// },
// rules: {
// 'no-unused-vars': ['error', { varsIgnorePattern: '^[A-Z_]' }],
// },
// },
]);prettier config
Create prettier.config.mjs file, then add the following code
// import prettier config
import configs from "eslint-config-xx/prettier.config.mjs";
export default configs;js 项目
Parsing error: project was set to true but couldn't find any tsconfig.json relative
在根目录下新建tsconfig.json
{
"compilerOptions": {
"module": "esnext",
"target": "ES2015",
"lib": ["es6", "dom", "es2016", "es2017"],
"sourceMap": true,
"allowJs": true,
"outDir": "dist",
"moduleResolution": "bundler",
"forceConsistentCasingInFileNames": true,
"noImplicitReturns": true,
"noImplicitThis": true,
"noImplicitAny": true,
"strictNullChecks": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"esModuleInterop": true,
"resolveJsonModule": true,
"jsx": "react-jsx"
},
"include": ["./eslint.config.mjs", "./prettier.config.mjs"],
"exclude": ["node_modules"]
}