|
| 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 | + "es6": true |
| 28 | + }, |
| 29 | + "extends": ["eslint:recommended", "plugin:react/all"], |
| 30 | + "plugins": [ |
| 31 | + "react" |
| 32 | + ], |
| 33 | + "parser": "babel-eslint", |
| 34 | + "parserOptions": { |
| 35 | + "ecmaFeatures": { |
| 36 | + "jsx": true, |
| 37 | + "modules": true |
| 38 | + }, |
| 39 | + "ecmaVersion": 6 |
| 40 | + }, |
| 41 | + "globals": { |
| 42 | + // If "no-undef" is enabled below, be sure to list all global variables that |
| 43 | + // are used in this app's backend code (including the globalIds of models): |
| 44 | + // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
| 45 | + "Promise": true, |
| 46 | + "sails": true, |
| 47 | + "_": true, |
| 48 | + "process": true |
| 49 | + // …and any others (e.g. `"Organization": true`) |
| 50 | + // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
| 51 | + }, |
| 52 | + "rules": { |
| 53 | + "block-scoped-var": [ |
| 54 | + "error" |
| 55 | + ], |
| 56 | + "callback-return": [ |
| 57 | + "error", |
| 58 | + [ |
| 59 | + "done", |
| 60 | + "proceed", |
| 61 | + "next", |
| 62 | + "onwards", |
| 63 | + "callback", |
| 64 | + "cb" |
| 65 | + ] |
| 66 | + ], |
| 67 | + "camelcase": [ |
| 68 | + "warn", |
| 69 | + { |
| 70 | + "properties": "always" |
| 71 | + } |
| 72 | + ], |
| 73 | + "comma-style": [ |
| 74 | + "warn", |
| 75 | + "last" |
| 76 | + ], |
| 77 | + "curly": [ |
| 78 | + "warn" |
| 79 | + ], |
| 80 | + "eqeqeq": [ |
| 81 | + "error", |
| 82 | + "always" |
| 83 | + ], |
| 84 | + "eol-last": [ |
| 85 | + "warn" |
| 86 | + ], |
| 87 | + "handle-callback-err": [ |
| 88 | + "error" |
| 89 | + ], |
| 90 | + "indent": [ |
| 91 | + "warn", |
| 92 | + 4, |
| 93 | + { |
| 94 | + "SwitchCase": 1, |
| 95 | + "MemberExpression": "off", |
| 96 | + "FunctionDeclaration": { |
| 97 | + "body": 1, |
| 98 | + "parameters": "off" |
| 99 | + }, |
| 100 | + "FunctionExpression": { |
| 101 | + "body": 1, |
| 102 | + "parameters": "off" |
| 103 | + }, |
| 104 | + "CallExpression": { |
| 105 | + "arguments": "off" |
| 106 | + }, |
| 107 | + "ArrayExpression": 1, |
| 108 | + "ObjectExpression": 1, |
| 109 | + "ignoredNodes": [ |
| 110 | + "ConditionalExpression" |
| 111 | + ] |
| 112 | + } |
| 113 | + ], |
| 114 | + "linebreak-style": [ |
| 115 | + "error", |
| 116 | + "unix" |
| 117 | + ], |
| 118 | + "no-dupe-keys": [ |
| 119 | + "error" |
| 120 | + ], |
| 121 | + "no-duplicate-case": [ |
| 122 | + "error" |
| 123 | + ], |
| 124 | + "no-extra-semi": [ |
| 125 | + "warn" |
| 126 | + ], |
| 127 | + "no-labels": [ |
| 128 | + "error" |
| 129 | + ], |
| 130 | + "no-mixed-spaces-and-tabs": [ |
| 131 | + 2, |
| 132 | + "smart-tabs" |
| 133 | + ], |
| 134 | + "no-redeclare": [ |
| 135 | + "warn" |
| 136 | + ], |
| 137 | + "no-return-assign": [ |
| 138 | + "error", |
| 139 | + "always" |
| 140 | + ], |
| 141 | + "no-sequences": [ |
| 142 | + "error" |
| 143 | + ], |
| 144 | + "no-trailing-spaces": [ |
| 145 | + "off" |
| 146 | + ], |
| 147 | + "no-undef": [ |
| 148 | + "off" |
| 149 | + ], |
| 150 | + // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
| 151 | + // ^^Note: If this "no-undef" rule is enabled (set to `["error"]`), then all model globals |
| 152 | + // (e.g. `"Organization": true`) should be included above under "globals". |
| 153 | + // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
| 154 | + "no-unexpected-multiline": [ |
| 155 | + "warn" |
| 156 | + ], |
| 157 | + "no-unreachable": [ |
| 158 | + "warn" |
| 159 | + ], |
| 160 | + "no-unused-vars": [ |
| 161 | + "warn", |
| 162 | + { |
| 163 | + "caughtErrors": "all", |
| 164 | + "caughtErrorsIgnorePattern": "^unused($|[A-Z].*$)", |
| 165 | + "argsIgnorePattern": "^unused($|[A-Z].*$)", |
| 166 | + "varsIgnorePattern": "^unused($|[A-Z].*$)" |
| 167 | + } |
| 168 | + ], |
| 169 | + "no-use-before-define": [ |
| 170 | + "error", |
| 171 | + { |
| 172 | + "functions": false |
| 173 | + } |
| 174 | + ], |
| 175 | + "one-var": [ |
| 176 | + "off", |
| 177 | + "never" |
| 178 | + ], |
| 179 | + "prefer-arrow-callback": [ |
| 180 | + "warn", |
| 181 | + { |
| 182 | + "allowNamedFunctions": true |
| 183 | + } |
| 184 | + ], |
| 185 | + "quotes": [ |
| 186 | + "warn", |
| 187 | + "single", |
| 188 | + { |
| 189 | + "avoidEscape": false, |
| 190 | + "allowTemplateLiterals": true |
| 191 | + } |
| 192 | + ], |
| 193 | + "react/static-property-placement": "off", |
| 194 | + "react/jsx-one-expression-per-line": "off", |
| 195 | + "react/destructuring-assignment": "off", |
| 196 | + "react/jsx-no-literals": "off", |
| 197 | + "react/jsx-max-props-per-line": "off", |
| 198 | + "react/jsx-sort-props": "off", |
| 199 | + "react/jsx-max-depth": "off", |
| 200 | + "react/no-unescaped-entities": "off", |
| 201 | + "react/jsx-indent-props": "off", |
| 202 | + "react/no-set-state": "off", |
| 203 | + "react/require-optimization": "off", |
| 204 | + "no-irregular-whitespace": "off", |
| 205 | + "react/forbid-component-props": "off", |
| 206 | + "react/jsx-no-bind": "off", |
| 207 | + "react/forbid-prop-types": "off", |
| 208 | + "react/no-multi-comp": "off", |
| 209 | + "react/jsx-handler-names": "off", |
| 210 | + "no-inner-declarations": "off", |
| 211 | + "semi": [ |
| 212 | + "warn", |
| 213 | + "always" |
| 214 | + ], |
| 215 | + "semi-spacing": [ |
| 216 | + "warn", |
| 217 | + { |
| 218 | + "before": false, |
| 219 | + "after": true |
| 220 | + } |
| 221 | + ], |
| 222 | + "semi-style": [ |
| 223 | + "warn", |
| 224 | + "last" |
| 225 | + ] |
| 226 | + } |
| 227 | +} |
0 commit comments