|
| 1 | +{ |
| 2 | + // ╔═╗╔═╗╦ ╦╔╗╔╔╦╗┬─┐┌─┐ |
| 3 | + // ║╣ ╚═╗║ ║║║║ ║ ├┬┘│ |
| 4 | + // o╚═╝╚═╝╩═╝╩╝╚╝ ╩ ┴└─└─┘ |
| 5 | + // A set of basic code conventions designed to encourage quality and consistency |
| 6 | + // across your Sails app's code base. These rules are checked against |
| 7 | + // 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 | + |
| 25 | + "env": { |
| 26 | + "node": true |
| 27 | + }, |
| 28 | + |
| 29 | + "parserOptions": { |
| 30 | + "ecmaVersion": 2018 |
| 31 | + }, |
| 32 | + |
| 33 | + "globals": { |
| 34 | + // If "no-undef" is enabled below, be sure to list all global variables that |
| 35 | + // are used in this app's backend code (including the globalIds of models): |
| 36 | + // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
| 37 | + "Promise": true, |
| 38 | + "sails": true, |
| 39 | + "_": true |
| 40 | + // …and any others (e.g. `"Organization": true`) |
| 41 | + // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
| 42 | + }, |
| 43 | + |
| 44 | + "rules": { |
| 45 | + "block-scoped-var": ["error"], |
| 46 | + "callback-return": ["error", ["done", "proceed", "next", "onwards", "callback", "cb"]], |
| 47 | + "camelcase": ["warn", {"properties":"always"}], |
| 48 | + "comma-style": ["warn", "last"], |
| 49 | + "curly": ["warn"], |
| 50 | + "eqeqeq": ["error", "always"], |
| 51 | + "eol-last": ["warn"], |
| 52 | + "handle-callback-err": ["error"], |
| 53 | + "indent": ["warn", 2, { |
| 54 | + "SwitchCase": 1, |
| 55 | + "MemberExpression": "off", |
| 56 | + "FunctionDeclaration": {"body":1, "parameters":"off"}, |
| 57 | + "FunctionExpression": {"body":1, "parameters":"off"}, |
| 58 | + "CallExpression": {"arguments":"off"}, |
| 59 | + "ArrayExpression": 1, |
| 60 | + "ObjectExpression": 1, |
| 61 | + "ignoredNodes": ["ConditionalExpression"] |
| 62 | + }], |
| 63 | + "linebreak-style": ["error", "unix"], |
| 64 | + "no-dupe-keys": ["error"], |
| 65 | + "no-duplicate-case": ["error"], |
| 66 | + "no-extra-semi": ["warn"], |
| 67 | + "no-labels": ["error"], |
| 68 | + "no-mixed-spaces-and-tabs": [2, "smart-tabs"], |
| 69 | + "no-redeclare": ["warn"], |
| 70 | + "no-return-assign": ["error", "always"], |
| 71 | + "no-sequences": ["error"], |
| 72 | + "no-trailing-spaces": ["warn"], |
| 73 | + "no-undef": ["off"], |
| 74 | + // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
| 75 | + // ^^Note: If this "no-undef" rule is enabled (set to `["error"]`), then all model globals |
| 76 | + // (e.g. `"Organization": true`) should be included above under "globals". |
| 77 | + // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
| 78 | + "no-unexpected-multiline": ["warn"], |
| 79 | + "no-unreachable": ["warn"], |
| 80 | + "no-unused-vars": ["warn", {"caughtErrors":"all", "caughtErrorsIgnorePattern": "^unused($|[A-Z].*$)", "argsIgnorePattern": "^unused($|[A-Z].*$)", "varsIgnorePattern": "^unused($|[A-Z].*$)" }], |
| 81 | + "no-use-before-define": ["error", {"functions":false}], |
| 82 | + "one-var": ["warn", "never"], |
| 83 | + "prefer-arrow-callback": ["warn", {"allowNamedFunctions":true}], |
| 84 | + "quotes": ["warn", "single", {"avoidEscape":false, "allowTemplateLiterals":true}], |
| 85 | + "semi": ["warn", "always"], |
| 86 | + "semi-spacing": ["warn", {"before":false, "after":true}], |
| 87 | + "semi-style": ["warn", "last"] |
| 88 | + } |
| 89 | + |
| 90 | +} |
0 commit comments