.eslintrc.js 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295
  1. /*
  2. 👋 Hi! This file was autogenerated by tslint-to-eslint-config.
  3. https://github.com/typescript-eslint/tslint-to-eslint-config
  4. It represents the closest reasonable ESLint configuration to this
  5. project's original TSLint configuration.
  6. We recommend eventually switching this configuration to extend from
  7. the recommended rulesets in typescript-eslint.
  8. https://github.com/typescript-eslint/tslint-to-eslint-config/blob/master/docs/FAQs.md
  9. Happy linting! 💖
  10. */
  11. module.exports = {
  12. env: {
  13. es6: true,
  14. node: true,
  15. },
  16. extends: [
  17. 'plugin:@typescript-eslint/recommended',
  18. 'plugin:@typescript-eslint/recommended-requiring-type-checking',
  19. 'prettier',
  20. ],
  21. ignorePatterns: [
  22. '**/generated*',
  23. '**/*.js',
  24. '**/*.d.ts',
  25. '/packages/ui-devkit/scaffold/**/*',
  26. '/packages/dev-server/load-testing/**/*',
  27. '/docs/layouts/**/*',
  28. ],
  29. parser: '@typescript-eslint/parser',
  30. parserOptions: {
  31. project: true, // Resolve the nearest single tsconfig - See: https://github.com/typescript-eslint/typescript-eslint/issues/1192#issuecomment-1483926773
  32. sourceType: 'module',
  33. },
  34. plugins: [
  35. 'eslint-plugin-import',
  36. 'eslint-plugin-jsdoc',
  37. 'eslint-plugin-prefer-arrow',
  38. '@typescript-eslint',
  39. ],
  40. root: true,
  41. overrides: [
  42. {
  43. files: ['./packages/ui-devkit/src/client/**/*'],
  44. parserOptions: {
  45. project: './packages/ui-devkit/tsconfig.json',
  46. sourceType: 'module',
  47. },
  48. },
  49. {
  50. files: ['./packages/ui-devkit/src/compiler/**/*'],
  51. parserOptions: {
  52. project: './packages/ui-devkit/tsconfig.compiler.json',
  53. sourceType: 'module',
  54. },
  55. },
  56. ],
  57. rules: {
  58. '@typescript-eslint/adjacent-overload-signatures': 'error',
  59. '@typescript-eslint/array-type': [
  60. 'error',
  61. {
  62. default: 'array-simple',
  63. },
  64. ],
  65. '@typescript-eslint/await-thenable': 'error',
  66. '@typescript-eslint/ban-ts-comment': 'off',
  67. '@typescript-eslint/ban-types': [
  68. 'error',
  69. {
  70. types: {
  71. Object: {
  72. message: 'Avoid using the `Object` type. Did you mean `object`?',
  73. },
  74. Function: {
  75. message:
  76. 'Avoid using the `Function` type. Prefer a specific function type, like `() => void`.',
  77. },
  78. Boolean: {
  79. message: 'Avoid using the `Boolean` type. Did you mean `boolean`?',
  80. },
  81. Number: {
  82. message: 'Avoid using the `Number` type. Did you mean `number`?',
  83. },
  84. String: {
  85. message: 'Avoid using the `String` type. Did you mean `string`?',
  86. },
  87. Symbol: {
  88. message: 'Avoid using the `Symbol` type. Did you mean `symbol`?',
  89. },
  90. },
  91. },
  92. ],
  93. '@typescript-eslint/consistent-type-assertions': 'error',
  94. '@typescript-eslint/consistent-type-definitions': 'off',
  95. '@typescript-eslint/dot-notation': 'error',
  96. '@typescript-eslint/explicit-function-return-type': 'off',
  97. '@typescript-eslint/explicit-member-accessibility': [
  98. 'off',
  99. {
  100. accessibility: 'explicit',
  101. },
  102. ],
  103. '@typescript-eslint/explicit-module-boundary-types': 'off',
  104. '@typescript-eslint/indent': 'off',
  105. '@typescript-eslint/member-ordering': 'off',
  106. '@typescript-eslint/naming-convention': [
  107. 'off',
  108. {
  109. selector: 'variable',
  110. format: ['camelCase', 'UPPER_CASE'],
  111. leadingUnderscore: 'forbid',
  112. trailingUnderscore: 'forbid',
  113. },
  114. ],
  115. '@typescript-eslint/no-array-constructor': 'error',
  116. '@typescript-eslint/no-empty-function': 'error',
  117. '@typescript-eslint/no-empty-interface': 'off',
  118. '@typescript-eslint/no-explicit-any': 'off',
  119. '@typescript-eslint/no-extra-non-null-assertion': 'error',
  120. '@typescript-eslint/no-extra-semi': 'error',
  121. '@typescript-eslint/no-floating-promises': 'error',
  122. '@typescript-eslint/no-for-in-array': 'error',
  123. '@typescript-eslint/no-implied-eval': 'error',
  124. '@typescript-eslint/no-inferrable-types': [
  125. 'error',
  126. {
  127. ignoreParameters: true,
  128. },
  129. ],
  130. '@typescript-eslint/no-loss-of-precision': 'error',
  131. '@typescript-eslint/no-misused-new': 'error',
  132. '@typescript-eslint/no-misused-promises': 'warn',
  133. '@typescript-eslint/no-namespace': 'error',
  134. '@typescript-eslint/no-non-null-asserted-optional-chain': 'error',
  135. '@typescript-eslint/no-non-null-assertion': 'error',
  136. '@typescript-eslint/no-parameter-properties': 'off',
  137. '@typescript-eslint/no-shadow': [
  138. 'error',
  139. {
  140. hoist: 'all',
  141. },
  142. ],
  143. '@typescript-eslint/no-this-alias': 'error',
  144. '@typescript-eslint/no-unnecessary-type-assertion': 'error',
  145. '@typescript-eslint/no-unnecessary-type-constraint': 'error',
  146. '@typescript-eslint/no-unsafe-argument': 'off',
  147. '@typescript-eslint/no-unsafe-assignment': 'off',
  148. '@typescript-eslint/no-unsafe-call': 'off',
  149. '@typescript-eslint/no-unsafe-member-access': 'off',
  150. '@typescript-eslint/no-unsafe-return': 'off',
  151. '@typescript-eslint/no-unused-expressions': 'error',
  152. '@typescript-eslint/no-unused-vars': 'off',
  153. '@typescript-eslint/no-use-before-define': 'off',
  154. '@typescript-eslint/no-var-requires': 'error',
  155. '@typescript-eslint/prefer-as-const': 'error',
  156. '@typescript-eslint/prefer-for-of': 'error',
  157. '@typescript-eslint/prefer-function-type': 'error',
  158. '@typescript-eslint/prefer-namespace-keyword': 'error',
  159. '@typescript-eslint/quotes': 'off',
  160. '@typescript-eslint/require-await': 'warn',
  161. '@typescript-eslint/restrict-plus-operands': 'error',
  162. '@typescript-eslint/restrict-template-expressions': 'error',
  163. '@typescript-eslint/triple-slash-reference': [
  164. 'error',
  165. {
  166. path: 'always',
  167. types: 'prefer-import',
  168. lib: 'always',
  169. },
  170. ],
  171. '@typescript-eslint/typedef': 'off',
  172. '@typescript-eslint/unbound-method': 'error',
  173. '@typescript-eslint/unified-signatures': 'error',
  174. 'arrow-parens': ['off', 'always'],
  175. complexity: 'off',
  176. 'constructor-super': 'error',
  177. 'dot-notation': 'off',
  178. eqeqeq: ['error', 'smart'],
  179. 'guard-for-in': 'error',
  180. 'id-denylist': 'off',
  181. 'id-match': 'off',
  182. 'import/order': [
  183. 'error',
  184. {
  185. alphabetize: {
  186. caseInsensitive: true,
  187. order: 'asc',
  188. },
  189. 'newlines-between': 'always',
  190. groups: [
  191. ['builtin', 'external', 'internal', 'unknown', 'object', 'type'],
  192. 'parent',
  193. ['sibling', 'index'],
  194. ],
  195. distinctGroup: false,
  196. pathGroupsExcludedImportTypes: [],
  197. pathGroups: [
  198. {
  199. pattern: './',
  200. patternOptions: {
  201. nocomment: true,
  202. dot: true,
  203. },
  204. group: 'sibling',
  205. position: 'before',
  206. },
  207. {
  208. pattern: '.',
  209. patternOptions: {
  210. nocomment: true,
  211. dot: true,
  212. },
  213. group: 'sibling',
  214. position: 'before',
  215. },
  216. {
  217. pattern: '..',
  218. patternOptions: {
  219. nocomment: true,
  220. dot: true,
  221. },
  222. group: 'parent',
  223. position: 'before',
  224. },
  225. {
  226. pattern: '../',
  227. patternOptions: {
  228. nocomment: true,
  229. dot: true,
  230. },
  231. group: 'parent',
  232. position: 'before',
  233. },
  234. ],
  235. },
  236. ],
  237. indent: 'off',
  238. 'jsdoc/check-alignment': 'off',
  239. 'jsdoc/check-indentation': 'off',
  240. 'jsdoc/newline-after-description': 'off',
  241. 'max-classes-per-file': 'off',
  242. 'max-len': [
  243. 'error',
  244. {
  245. code: 170,
  246. },
  247. ],
  248. 'new-parens': 'error',
  249. 'no-array-constructor': 'off',
  250. 'no-bitwise': 'error',
  251. 'no-caller': 'error',
  252. 'no-cond-assign': 'error',
  253. 'no-console': 'error',
  254. 'no-debugger': 'error',
  255. 'no-empty': 'error',
  256. 'no-empty-function': 'off',
  257. 'no-eval': 'error',
  258. 'no-extra-semi': 'off',
  259. 'no-fallthrough': 'error',
  260. 'no-implied-eval': 'off',
  261. 'no-invalid-this': 'off',
  262. 'no-loss-of-precision': 'off',
  263. 'no-new-wrappers': 'error',
  264. 'no-shadow': 'off',
  265. 'no-throw-literal': 'error',
  266. 'no-trailing-spaces': 'error',
  267. 'no-undef-init': 'error',
  268. 'no-underscore-dangle': 'off',
  269. 'no-unsafe-finally': 'error',
  270. 'no-unused-expressions': 'off',
  271. 'no-unused-labels': 'error',
  272. 'no-unused-vars': 'off',
  273. 'no-use-before-define': 'off',
  274. 'no-var': 'error',
  275. 'object-shorthand': 'error',
  276. 'one-var': ['error', 'never'],
  277. 'prefer-arrow/prefer-arrow-functions': 'off',
  278. 'prefer-const': 'error',
  279. quotes: 'off',
  280. radix: 'error',
  281. 'require-await': 'off',
  282. 'spaced-comment': [
  283. 'error',
  284. 'always',
  285. {
  286. markers: ['/'],
  287. },
  288. ],
  289. 'use-isnan': 'error',
  290. 'valid-typeof': 'off',
  291. },
  292. };