threepipe
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

.eslintrc.cjs 9.1KB

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