eslint 配置

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
}
posted @ 2021-02-17 16:37  冬天之歌  阅读(62)  评论(0编辑  收藏  举报