index.js 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. // This config is used globally at the root of the repo, so it should be as thin
  2. // as possible with rules that we absolutely require across all projects.
  3. module.exports = {
  4. env: {
  5. es6: true,
  6. },
  7. globals: {
  8. Atomics: 'readonly',
  9. SharedArrayBuffer: 'readonly',
  10. },
  11. // We are relying on version that comes with @polkadot/dev
  12. // Newest version is breaking pioneer!
  13. parser: '@typescript-eslint/parser',
  14. parserOptions: {
  15. ecmaFeatures: {
  16. jsx: true,
  17. },
  18. ecmaVersion: 2019,
  19. sourceType: 'module',
  20. },
  21. extends: [
  22. 'standard',
  23. 'eslint:recommended',
  24. 'plugin:@typescript-eslint/recommended',
  25. 'plugin:react/recommended',
  26. // this is only in newer versions of eslint-plugin-react-hooks
  27. // 'plugin:react-hooks/recommended',
  28. 'plugin:prettier/recommended',
  29. 'prettier/@typescript-eslint',
  30. 'prettier/react',
  31. 'prettier/standard',
  32. ],
  33. settings: {
  34. react: {
  35. version: 'detect',
  36. },
  37. },
  38. rules: {
  39. // drop these when using newer versions of eslint-plugin-react-hooks
  40. 'react-hooks/rules-of-hooks': 'error',
  41. 'react-hooks/exhaustive-deps': 'warn',
  42. // only cli projects should really have this rule, web apps
  43. // should prefer using 'debug' package at least to allow control of
  44. // output verbosity if logging to console.
  45. 'no-console': 'off',
  46. 'camelcase': 'off',
  47. '@typescript-eslint/class-name-casing': 'off',
  48. "@typescript-eslint/naming-convention": [
  49. "error",
  50. {
  51. selector: 'default',
  52. format: ['camelCase'],
  53. },
  54. {
  55. selector: 'variable',
  56. format: ['camelCase', 'UPPER_CASE', 'PascalCase'],
  57. },
  58. {
  59. selector: 'property',
  60. format: [] // Don't force format of object properties, so they can be ie.: { "Some thing": 123 }, { some_thing: 123 } etc.
  61. },
  62. {
  63. selector: 'accessor',
  64. format: ['camelCase', 'snake_case']
  65. },
  66. {
  67. selector: 'enumMember',
  68. format: ['PascalCase']
  69. },
  70. {
  71. selector: 'typeLike',
  72. format: [],
  73. custom: { regex: '^([A-Z][a-z0-9]*_?)+', match: true }, // combined PascalCase and snake_case to allow ie. OpeningType_Worker
  74. }
  75. ],
  76. },
  77. plugins: ['standard', '@typescript-eslint', 'react', 'react-hooks', 'prettier'],
  78. }