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.

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