.eslintrc 4.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. {
  2. // ╔═╗╔═╗╦ ╦╔╗╔╔╦╗┬─┐┌─┐
  3. // ║╣ ╚═╗║ ║║║║ ║ ├┬┘│
  4. // o╚═╝╚═╝╩═╝╩╝╚╝ ╩ ┴└─└─┘
  5. // A set of basic code conventions (similar to a .jshintrc file) designed to
  6. // encourage quality and consistency across your Sails app's code base.
  7. // These rules are checked against automatically any time you run `npm test`.
  8. //
  9. // > An additional eslintrc override file is included in the `assets/` folder
  10. // > right out of the box. This is specifically to allow for variations in acceptable
  11. // > global variables between front-end JavaScript code designed to run in the browser
  12. // > vs. backend code designed to run in a Node.js/Sails process.
  13. //
  14. // > Note: If you're using mocha, you'll want to add an extra override file to your
  15. // > `test/` folder so that eslint will tolerate mocha-specific globals like `before`
  16. // > and `describe`.
  17. // Designed for ESLint v4.
  18. // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  19. // For more information about any of the rules below, check out the relevant
  20. // reference page on eslint.org. For example, to get details on "no-sequences",
  21. // you would visit `http://eslint.org/docs/rules/no-sequences`. If you're unsure
  22. // or could use some advice, come by https://sailsjs.com/support.
  23. // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  24. "env": {
  25. "node": true
  26. },
  27. "parserOptions": {
  28. "ecmaVersion": 8
  29. },
  30. "globals": {
  31. // If "no-undef" is enabled below and your app uses globals, be sure to list all
  32. // relevant globals below (including the globalIds of models, if appropriate):
  33. // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  34. "sails": true,
  35. "_": true,
  36. "async": true,
  37. "Promise": true,
  38. "User": true
  39. // ...and any other backend globals (e.g. `"Organization": true`)
  40. // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  41. },
  42. "rules": {
  43. "callback-return": ["error", ["done", "proceed", "next", "onwards", "callback", "cb"]],
  44. "camelcase": ["warn", {"properties":"always"}],
  45. "comma-style": ["warn", "last"],
  46. "curly": ["error"],
  47. "eqeqeq": ["error", "always"],
  48. "eol-last": ["warn"],
  49. "handle-callback-err": ["error"],
  50. "indent": ["warn", 2, {
  51. "SwitchCase": 1,
  52. "MemberExpression": "off",
  53. "FunctionDeclaration": {"body":1, "parameters":"off"},
  54. "FunctionExpression": {"body":1, "parameters":"off"},
  55. "CallExpression": {"arguments":"off"},
  56. "ArrayExpression": 1,
  57. "ObjectExpression": 1,
  58. "ignoredNodes": ["ConditionalExpression"]
  59. }],
  60. "linebreak-style": ["error", "unix"],
  61. "no-dupe-keys": ["error"],
  62. "no-duplicate-case": ["error"],
  63. "no-extra-semi": ["warn"],
  64. "no-labels": ["error"],
  65. "no-mixed-spaces-and-tabs": [2, "smart-tabs"],
  66. "no-redeclare": ["warn"],
  67. "no-return-assign": ["error", "always"],
  68. "no-sequences": ["error"],
  69. "no-trailing-spaces": ["warn"],
  70. "no-undef": ["error"],
  71. "no-unexpected-multiline": ["warn"],
  72. "no-unreachable": ["warn"],
  73. "no-unused-vars": ["warn", {"caughtErrors":"all", "caughtErrorsIgnorePattern": "^unused($|[A-Z].*$)"}],
  74. "no-use-before-define": ["error", {"functions":false}],
  75. "one-var": ["warn", "never"],
  76. "prefer-arrow-callback": ["warn", {"allowNamedFunctions":true}],
  77. "quotes": ["warn", "single", {"avoidEscape":false, "allowTemplateLiterals":true}],
  78. "semi": ["error", "always"],
  79. "semi-spacing": ["warn", {"before":false, "after":true}],
  80. "semi-style": ["warn", "last"]
  81. }
  82. }