threepipe
Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

.eslintrc.cjs 9.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214
  1. module.exports = {
  2. 'root': true,
  3. 'extends': [
  4. 'eslint:recommended',
  5. 'plugin:@typescript-eslint/eslint-recommended' ,
  6. 'plugin:@typescript-eslint/recommended', // Uses the recommended rules from the @typescript-eslint/eslint-plugin
  7. ],
  8. 'parserOptions': {
  9. 'ecmaVersion': 2018,
  10. 'sourceType': 'module', // Allows for the use of imports
  11. },
  12. 'plugins': [
  13. 'html',
  14. ],
  15. 'settings': {
  16. 'html/indent': 4,
  17. },
  18. 'env': {
  19. 'es6': true,
  20. 'node': true,
  21. },
  22. 'rules': {
  23. 'array-bracket-spacing': 'error',
  24. 'comma-style': 'error',
  25. 'space-before-blocks': 'error',
  26. 'space-before-function-paren': 'error',
  27. 'space-in-parens': 'error',
  28. 'space-infix-ops': 'error',
  29. 'space-unary-ops': 'error',
  30. 'spaced-comment': 'error',
  31. 'no-spaced-func': 'error',
  32. 'no-multi-spaces': 'error',
  33. 'no-regex-spaces': 'error',
  34. 'no-trailing-spaces': ['warn', { 'skipBlankLines': true }],
  35. 'no-mixed-spaces-and-tabs': 'error',
  36. 'no-irregular-whitespace': 'error',
  37. 'no-whitespace-before-property': 'error',
  38. 'default-case': 'error',
  39. 'require-jsdoc': 'warn',
  40. 'camelcase': 'error',
  41. 'comma-dangle': ['error', 'always-multiline'],
  42. 'indent': ['error', 4],
  43. 'quotes': ['error', 'single'],
  44. // 'linebreak-style': ['error', 'unix'],
  45. 'no-loss-of-precision': 'error',
  46. },
  47. 'overrides': [
  48. {
  49. 'files': ['**/*.ts', '**/*.tsx'],
  50. 'parser': '@typescript-eslint/parser', // Specifies the ESLint parser
  51. 'parserOptions': {
  52. 'ecmaVersion': 2021, // Allows for the parsing of modern ECMAScript features
  53. 'sourceType': 'module', // Allows for the use of imports
  54. 'project': ['./tsconfig.json', './examples/tsconfig.json',
  55. './plugins/**/tsconfig.json',
  56. ],
  57. 'tsconfigRootDir': './',
  58. },
  59. 'extends': [
  60. 'eslint:recommended',
  61. 'plugin:@typescript-eslint/eslint-recommended' ,
  62. 'plugin:@typescript-eslint/recommended', // Uses the recommended rules from the @typescript-eslint/eslint-plugin
  63. ],
  64. 'env': {
  65. 'browser': true,
  66. 'es6': true,
  67. },
  68. 'plugins': [
  69. 'html',
  70. '@typescript-eslint',
  71. 'import',
  72. 'deprecation',
  73. ],
  74. 'settings': {
  75. 'html/indent': 4,
  76. 'import/resolver': {
  77. 'typescript': {},
  78. },
  79. },
  80. 'rules': {
  81. // Place to specify ESLint rules. Can be used to overwrite rules specified from the extended configs
  82. // e.g. "@typescript-eslint/explicit-function-return-type": "off",
  83. '@typescript-eslint/no-explicit-any': 'off',
  84. 'camelcase': 'off',
  85. '@typescript-eslint/naming-convention': [ // https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/naming-convention.md
  86. 'error',
  87. {
  88. 'selector': 'default',
  89. 'format': ['camelCase', 'snake_case', 'PascalCase'],
  90. },
  91. {
  92. 'selector': 'variable',
  93. 'format': ['camelCase', 'UPPER_CASE'],
  94. },
  95. {
  96. 'selector': 'parameter',
  97. 'format': ['camelCase'],
  98. 'leadingUnderscore': 'allow',
  99. },
  100. {
  101. 'selector': 'memberLike',
  102. 'modifiers': ['private'],
  103. 'format': ['camelCase'],
  104. 'leadingUnderscore': 'require',
  105. },
  106. {
  107. 'selector': 'memberLike',
  108. 'modifiers': ['protected'],
  109. 'format': ['camelCase'],
  110. 'leadingUnderscore': 'require',
  111. },
  112. {
  113. 'selector': ['typeLike'],
  114. 'format': ['PascalCase'],
  115. },
  116. {
  117. 'selector': ['enumMember'],
  118. 'format': ['PascalCase', 'UPPER_CASE'],
  119. },
  120. {
  121. 'selector': 'memberLike',
  122. 'modifiers': ['static'],
  123. 'format': ['PascalCase', 'UPPER_CASE'],
  124. },
  125. {
  126. 'selector': 'objectLiteralProperty',
  127. 'format': ['camelCase', 'snake_case', 'PascalCase'],
  128. 'leadingUnderscore': 'allowSingleOrDouble',
  129. },
  130. {
  131. 'selector': 'typeProperty',
  132. 'format': ['camelCase', 'snake_case', 'PascalCase', 'UPPER_CASE'],
  133. 'leadingUnderscore': 'allowSingleOrDouble',
  134. },
  135. ],
  136. 'semi': 'off',
  137. '@typescript-eslint/semi': ['error','never', { 'beforeStatementContinuationChars': 'always' }],
  138. 'no-extra-semi': 'off',
  139. '@typescript-eslint/no-extra-semi': ['error'],
  140. '@typescript-eslint/adjacent-overload-signatures': 'error',
  141. 'comma-spacing': 'off',
  142. '@typescript-eslint/comma-spacing': ['error'],
  143. 'no-extra-parens': 'off',
  144. '@typescript-eslint/no-extra-parens': ['error'],
  145. 'brace-style': 'off',
  146. '@typescript-eslint/brace-style': ['warn', '1tbs', { 'allowSingleLine': true }],
  147. '@typescript-eslint/consistent-type-definitions': ['error', 'interface'],
  148. 'default-param-last': 'off',
  149. '@typescript-eslint/default-param-last': ['error'],
  150. 'func-call-spacing': 'off',
  151. '@typescript-eslint/func-call-spacing': ['error'],
  152. 'keyword-spacing': 'off',
  153. 'object-curly-spacing': 'off',
  154. '@typescript-eslint/object-curly-spacing': ['error'],
  155. '@typescript-eslint/keyword-spacing': ['error'],
  156. 'space-before-function-paren': 'off',
  157. '@typescript-eslint/space-before-function-paren': ['error','never'],
  158. 'no-shadow': 'off',
  159. 'no-magic-numbers': 'off',
  160. // '@typescript-eslint/no-magic-numbers': [
  161. // 'warn', {
  162. // 'ignoreEnums': true,
  163. // 'ignoreNumericLiteralTypes': true,
  164. // 'ignoreReadonlyClassProperties': true,
  165. // },
  166. // ],
  167. '@typescript-eslint/promise-function-async': [
  168. 'error',
  169. {
  170. 'allowedPromiseNames': ['Thenable'],
  171. 'checkArrowFunctions': true,
  172. 'checkFunctionDeclarations': true,
  173. 'checkFunctionExpressions': true,
  174. 'checkMethodDeclarations': true,
  175. },
  176. ],
  177. 'dot-notation': 'off', // https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/dot-notation.md
  178. '@typescript-eslint/dot-notation': ['error'],
  179. '@typescript-eslint/prefer-string-starts-ends-with': 'error',
  180. '@typescript-eslint/prefer-includes': 'error',
  181. '@typescript-eslint/prefer-for-of': 'error',
  182. '@typescript-eslint/prefer-as-const': 'error',
  183. '@typescript-eslint/prefer-function-type': 'error',
  184. '@typescript-eslint/no-unsafe-call': 'warn',
  185. '@typescript-eslint/no-misused-new': 'error',
  186. '@typescript-eslint/no-namespace': 'error',
  187. '@typescript-eslint/non-nullable-type-assertion-style': 'error',
  188. 'no-invalid-this': 'off',
  189. '@typescript-eslint/no-invalid-this': ['error'],
  190. '@typescript-eslint/prefer-ts-expect-error': ['error'],
  191. 'no-loop-func': 'off',
  192. '@typescript-eslint/no-loop-func': ['error'],
  193. 'no-loss-of-precision': 'off',
  194. '@typescript-eslint/no-loss-of-precision': ['error'],
  195. '@typescript-eslint/no-shadow': ['error'],
  196. 'no-duplicate-imports': 'off',
  197. '@typescript-eslint/no-duplicate-imports': ['error', { 'includeExports': false }],
  198. // "@typescript-eslint/prefer-nullish-coalescing": ["error", {ignoreConditionalTests: false, ignoreMixedLogicalExpressions: false}],
  199. 'comma-dangle': 'off',
  200. '@typescript-eslint/comma-dangle': ['error', {
  201. 'arrays': 'always-multiline',
  202. 'objects': 'always-multiline',
  203. 'imports': 'always-multiline',
  204. 'exports': 'always-multiline',
  205. 'functions': 'only-multiline',
  206. }],
  207. 'deprecation/deprecation': 'warn',
  208. },
  209. 'globals': { 'Atomics': 'readonly', 'SharedArrayBuffer': 'readonly' },
  210. },
  211. ],
  212. }