首页 > 其他 > 详细

eslint 配置

时间:2021-02-17 23:57:57      阅读:32      评论:0      收藏:0      [点我收藏+]

eslint配置

module.exports = {
  root: true,
  parser: ‘@typescript-eslint/parser‘,
  parserOptions: {
    ecmaVersion: 2020, // Use the latest ecmascript standard
    sourceType: ‘module‘, // Allows using import/export statements
    ecmaFeatures: {
      jsx: true // Enable JSX since we‘re using React
    }
  },
  env: {
    browser: true, // Enables browser globals like window and document
    amd: true, // Enables require() and define() as global variables as per the amd spec.
    node: true // Enables Node.js global variables and Node.js scoping.
  },
  extends: [
    ‘standard‘,
    ‘plugin:@typescript-eslint/recommended‘,
    ‘plugin:react/recommended‘,
    ‘plugin:react-hooks/recommended‘,
    ‘plugin:jsx-a11y/recommended‘
    // ‘plugin:prettier/recommended‘
  ],
  plugins: [‘@typescript-eslint‘, ‘prettier‘],
  settings: {
    react: {
      version: ‘detect‘ // Automatically detect the react version
    }
  },
  rules: {
    ‘prettier/prettier‘: [‘error‘, {}, { usePrettierrc: true }],
    // ‘React‘ must be in scope when using JSX
    ‘react/react-in-jsx-scope‘: ‘off‘,
    ‘space-before-function-paren‘: ‘off‘
  }
}

prettier配置

module.exports = {
  singleQuote: true,
  trailingComma: ‘none‘,
  semi: false
}

eslint 配置

原文:https://www.cnblogs.com/li1234yun/p/14409141.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!