.eslintrc.js 3.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. const { resolve } = require('path');
  2. module.exports = {
  3. // https://eslint.org/docs/user-guide/configuring#configuration-cascading-and-hierarchy
  4. // This option interrupts the configuration hierarchy at this file
  5. // Remove this if you have an higher level ESLint config file (it usually happens into a monorepos)
  6. root: true,
  7. // https://eslint.vuejs.org/user-guide/#how-to-use-custom-parser
  8. // Must use parserOptions instead of "parser" to allow vue-eslint-parser to keep working
  9. // `parser: 'vue-eslint-parser'` is already included with any 'plugin:vue/**' config and should be omitted
  10. parserOptions: {
  11. // https://github.com/typescript-eslint/typescript-eslint/tree/master/packages/parser#configuration
  12. // https://github.com/TypeStrong/fork-ts-checker-webpack-plugin#eslint
  13. // Needed to make the parser take into account 'vue' files
  14. extraFileExtensions: ['.vue'],
  15. parser: '@typescript-eslint/parser',
  16. project: resolve(__dirname, './tsconfig.json'),
  17. tsconfigRootDir: __dirname,
  18. ecmaVersion: 2018, // Allows for the parsing of modern ECMAScript features
  19. sourceType: 'module' // Allows for the use of imports
  20. },
  21. env: {
  22. browser: true
  23. },
  24. // Rules order is important, please avoid shuffling them
  25. extends: [
  26. // Base ESLint recommended rules
  27. // 'eslint:recommended',
  28. // https://github.com/typescript-eslint/typescript-eslint/tree/master/packages/eslint-plugin#usage
  29. // ESLint typescript rules
  30. 'plugin:@typescript-eslint/recommended',
  31. // consider disabling this class of rules if linting takes too long
  32. 'plugin:@typescript-eslint/recommended-requiring-type-checking',
  33. // Uncomment any of the lines below to choose desired strictness,
  34. // but leave only one uncommented!
  35. // See https://eslint.vuejs.org/rules/#available-rules
  36. // 'plugin:vue/vue3-essential', // Priority A: Essential (Error Prevention)
  37. // 'plugin:vue/vue3-strongly-recommended', // Priority B: Strongly Recommended (Improving Readability)
  38. 'plugin:vue/vue3-recommended', // Priority C: Recommended (Minimizing Arbitrary Choices and Cognitive Overhead)
  39. // https://github.com/prettier/eslint-config-prettier#installation
  40. // usage with Prettier, provided by 'eslint-config-prettier'.
  41. 'prettier'
  42. ],
  43. plugins: [
  44. // required to apply rules which need type information
  45. '@typescript-eslint',
  46. // https://eslint.vuejs.org/user-guide/#why-doesn-t-it-work-on-vue-file
  47. // required to lint *.vue files
  48. 'vue',
  49. // https://github.com/typescript-eslint/typescript-eslint/issues/389#issuecomment-509292674
  50. // Prettier has not been included as plugin to avoid performance impact
  51. // add it as an extension for your IDE
  52. ],
  53. globals: {
  54. ga: 'readonly', // Google Analytics
  55. cordova: 'readonly',
  56. __statics: 'readonly',
  57. __QUASAR_SSR__: 'readonly',
  58. __QUASAR_SSR_SERVER__: 'readonly',
  59. __QUASAR_SSR_CLIENT__: 'readonly',
  60. __QUASAR_SSR_PWA__: 'readonly',
  61. process: 'readonly',
  62. Capacitor: 'readonly',
  63. chrome: 'readonly'
  64. },
  65. // add your custom rules here
  66. rules: {
  67. 'prefer-promise-reject-errors': 'off',
  68. // TypeScript
  69. quotes: ['warn', 'single', { avoidEscape: true }],
  70. '@typescript-eslint/explicit-function-return-type': 'off',
  71. '@typescript-eslint/explicit-module-boundary-types': 'off',
  72. // allow debugger during development only
  73. 'no-debugger': process.env.NODE_ENV === 'production' ? 'error' : 'off'
  74. }
  75. }