index.js 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  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. '@typescript-eslint/camelcase': 'off',
  47. '@typescript-eslint/naming-convention': [
  48. 'error',
  49. {
  50. selector: 'default',
  51. format: ['camelCase'],
  52. },
  53. {
  54. selector: 'variable',
  55. format: ['camelCase', 'UPPER_CASE'],
  56. },
  57. {
  58. selector: 'typeLike',
  59. format: ['PascalCase'],
  60. },
  61. {
  62. selector: 'property',
  63. format: [], // Don't force format of object properties, so they can be ie.: { "Some thing": 123 }, { some_thing: 123 } etc.
  64. },
  65. {
  66. selector: 'enumMember',
  67. format: ['PascalCase'],
  68. },
  69. ],
  70. },
  71. plugins: ['standard', '@typescript-eslint', 'react', 'react-hooks', 'prettier'],
  72. }