eslint.config.mjs怎么使用

来源:1-1 -导学

zac707

2024-06-22

运行npx eslint --init 无法生成.eslintrc.js,生成了eslint.config.mjs,怎么使用?

写回答

2回答

皮小西

2024-07-12

这是我的配置,供参考:

import globals from "globals";
import pluginJs from "@eslint/js";
import tseslint from "typescript-eslint";
import pluginReactConfig from "eslint-plugin-react/configs/recommended.js";
import { fixupConfigRules } from "@eslint/compat";


export default [
  {files: ["**/*.{js,mjs,cjs,ts,jsx,tsx}"]},
  { languageOptions: { parserOptions: { ecmaFeatures: { jsx: true } } } },
  {languageOptions: { globals: globals.browser }},
  pluginJs.configs.recommended,
  ...tseslint.configs.recommended,
  ...fixupConfigRules(pluginReactConfig),
];


0
0

双越

2024-06-23

都是 eslint 的配置文件,配置内容都是一样的。

格式可参考 https://eslint.org/docs/latest/use/configure/configuration-files 

0
1
拉塞尔_大华
运行npm run lint 提示: > react-ts-demo@0.1.0 lint > eslint 'src/**/*.+(js/|ts|jsx|tsx)' Oops! Something went wrong! :( ESLint: 8.57.1 No files matching the pattern "src/**/*.+(js/|ts|jsx|tsx)" were found. Please check for typing mistakes in the pattern.
2024-12-26
共1条回复

React18+ Nest.js 全栈开发仿问卷星项目

React18+TS4+Antd5+Next.js13 ,B端+C 端,完整业务

383 学习 · 252 问题

查看课程