请稍等 ...
×

采纳答案成功!

向帮助你的同学说点啥吧!感谢那些助人为乐的人

eslint.config.mjs怎么使用

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

正在回答 回答被采纳积分+3

插入代码

2回答

皮小西 2024-07-12 14:28:28

这是我的配置,供参考:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
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 回复 有任何疑惑可以回复我~
双越 2024-06-23 10:48:40

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

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

0 回复 有任何疑惑可以回复我~
  • 运行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 22:48:26
问题已解决,确定采纳
还有疑问,暂不采纳
微信客服

购课补贴
联系客服咨询优惠详情

帮助反馈 APP下载

慕课网APP
您的移动学习伙伴

公众号

扫描二维码
关注慕课网微信公众号