| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent a81ff70 commit df697c4
546 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -24,21 +24,53 @@ ESLint is a tool for identifying and reporting on patterns found in ECMAScript/J | |||
| 24 | 24 | * ESLint uses an AST to evaluate patterns in code. | |
| 25 | 25 | * ESLint is completely pluggable, every single rule is a plugin and you can add more at runtime. | |
| 26 | 26 | ||
| 27 | - ## Installation | ||
| 27 | + ## Installation and Usage | ||
| 28 | 28 | ||
| 29 | - You can install ESLint using npm: | ||
| 29 | + There are two ways to install ESLint: globally and locally. | ||
| 30 | 30 | ||
| 31 | - npm install -g eslint | ||
| 31 | + ### Local Installation and Usage | ||
| 32 | 32 | ||
| 33 | - ## Usage | ||
| 33 | + If you want to include ESLint as part of your project's build system, we recommend installing it locally. You can do so using npm: | ||
| 34 | 34 | ||
| 35 | - If it's your first time using ESLint, you should set up a config file using `--init`: | ||
| 35 | + ``` | ||
| 36 | + $ npm install eslint --save-dev | ||
| 37 | + ``` | ||
| 38 | + | ||
| 39 | + You should then setup a configuration file: | ||
| 40 | + | ||
| 41 | + ``` | ||
| 42 | + $ ./node_modules/.bin/eslint --init | ||
| 43 | + ``` | ||
| 44 | + | ||
| 45 | + After that, you can run ESLint on any file or directory like this: | ||
| 46 | + | ||
| 47 | + ``` | ||
| 48 | + $ ./node_modules/.bin/eslint yourfile.js | ||
| 49 | + ``` | ||
| 50 | + | ||
| 51 | + Any plugins or shareable configs that you use must also be installed locally to work with a locally-installed ESLint. | ||
| 52 | + | ||
| 53 | + ### Global Installation and Usage | ||
| 36 | 54 | ||
| 37 | - eslint --init | ||
| 55 | + If you want to make ESLint available to tools that run across all of your projects, we recommend installing ESLint globally. You can do so using npm: | ||
| 38 | 56 | ||
| 39 | - After that, you can run ESLint on any JavaScript file: | ||
| 57 | + ``` | ||
| 58 | + $ npm install -g eslint | ||
| 59 | + ``` | ||
| 40 | 60 | ||
| 41 | - eslint test.js test2.js | ||
| 61 | + You should then setup a configuration file: | ||
| 62 | + | ||
| 63 | + ``` | ||
| 64 | + $ eslint --init | ||
| 65 | + ``` | ||
| 66 | + | ||
| 67 | + After that, you can run ESLint on any file or directory like this: | ||
| 68 | + | ||
| 69 | + ``` | ||
| 70 | + $ eslint yourfile.js | ||
| 71 | + ``` | ||
| 72 | + | ||
| 73 | + Any plugins or shareable configs that you use must also be installed globally to work with a globally-installed ESLint. | ||
| 42 | 74 | ||
| 43 | 75 | **Note:** `eslint --init` is intended for setting up and configuring ESLint on a per-project basis and will perform a local installation of ESLint and its plugins in the directory in which it is run. If you prefer using a global installation of ESLint, any plugins used in your configuration must also be installed globally. | |
| 44 | 76 | ||
@@ -55,7 +87,7 @@ After running `eslint --init`, you'll have a `.eslintrc` file in your directory. | |||
| 55 | 87 | } | |
| 56 | 88 | ``` | |
| 57 | 89 | ||
| 58 | - The names `"semi"` and `"quotes"` are the names of [rules](http://eslint.org/docs/rules) in ESLint. The number is the error level of the rule and can be one of the three values: | ||
| 90 | + The names `"semi"` and `"quotes"` are the names of [rules](http://eslint.org/docs/rules) in ESLint. The first value is the error level of the rule and can be one of these values: | ||
| 59 | 91 | ||
| 60 | 92 | * `"off"` or `0` - turn the rule off | |
| 61 | 93 | * `"warn"` or `1` - turn the rule on as a warning (doesn't affect exit code) | |
@@ -65,31 +97,40 @@ The three error levels allow you fine-grained control over how ESLint applies ru | |||
| 65 | 97 | ||
| 66 | 98 | ## Sponsors | |
| 67 | 99 | ||
| 68 | - * Development is sponsored by [Box](https://box.com) | ||
| 69 | 100 | * Site search ([eslint.org](http://eslint.org)) is sponsored by [Algolia](https://www.algolia.com) | |
| 70 | 101 | ||
| 71 | 102 | ## Team | |
| 72 | 103 | ||
| 73 | - These folks keep the project moving and are resources for help: | ||
| 74 | - | ||
| 75 | - * Nicholas C. Zakas ([@nzakas](https://github.com/nzakas)) - project lead | ||
| 76 | - * Ilya Volodin ([@ilyavolodin](https://github.com/ilyavolodin)) - reviewer | ||
| 77 | - * Brandon Mills ([@btmills](https://github.com/btmills)) - reviewer | ||
| 78 | - * Gyandeep Singh ([@gyandeeps](https://github.com/gyandeeps)) - reviewer | ||
| 79 | - * Toru Nagashima ([@mysticatea](https://github.com/mysticatea)) - reviewer | ||
| 80 | - * Alberto Rodríguez ([@alberto](https://github.com/alberto)) - reviewer | ||
| 81 | - * Mathias Schreck ([@lo1tuma](https://github.com/lo1tuma)) - committer | ||
| 82 | - * Jamund Ferguson ([@xjamundx](https://github.com/xjamundx)) - committer | ||
| 83 | - * Ian VanSchooten ([@ianvs](https://github.com/ianvs)) - committer | ||
| 84 | - * Burak Yiğit Kaya ([@byk](https://github.com/byk)) - committer | ||
| 85 | - * Kai Cataldo ([@kaicataldo](https://github.com/kaicataldo)) - committer | ||
| 86 | - * Michael Ficarra ([@michaelficarra](https://github.com/michaelficarra)) - committer | ||
| 87 | - * Mark Pedrotti ([@pedrottimark](https://github.com/pedrottimark)) - committer | ||
| 88 | - * Oleg Gaidarenko ([@markelog](https://github.com/markelog)) - committer | ||
| 89 | - * Mike Sherov [@mikesherov](https://github.com/mikesherov)) - committer | ||
| 90 | - * Henry Zhu ([@hzoo](https://github.com/hzoo)) - committer | ||
| 91 | - * Marat Dulin ([@mdevils](https://github.com/mdevils)) - committer | ||
| 92 | - * Alexej Yaroshevich ([@zxqfox](https://github.com/zxqfox)) - committer | ||
| 104 | + These folks keep the project moving and are resources for help. | ||
| 105 | + | ||
| 106 | + ### Technical Steering Committee (TSC) | ||
| 107 | + | ||
| 108 | + * Nicholas C. Zakas ([@nzakas](https://github.com/nzakas)) | ||
| 109 | + * Ilya Volodin ([@ilyavolodin](https://github.com/ilyavolodin)) | ||
| 110 | + * Brandon Mills ([@btmills](https://github.com/btmills)) | ||
| 111 | + * Gyandeep Singh ([@gyandeeps](https://github.com/gyandeeps)) | ||
| 112 | + * Toru Nagashima ([@mysticatea](https://github.com/mysticatea)) | ||
| 113 | + * Alberto Rodríguez ([@alberto](https://github.com/alberto)) | ||
| 114 | + | ||
| 115 | + ### Development Team | ||
| 116 | + | ||
| 117 | + * Mathias Schreck ([@lo1tuma](https://github.com/lo1tuma)) | ||
| 118 | + * Jamund Ferguson ([@xjamundx](https://github.com/xjamundx)) | ||
| 119 | + * Ian VanSchooten ([@ianvs](https://github.com/ianvs)) | ||
| 120 | + * Burak Yiğit Kaya ([@byk](https://github.com/byk)) | ||
| 121 | + * Kai Cataldo ([@kaicataldo](https://github.com/kaicataldo)) | ||
| 122 | + * Michael Ficarra ([@michaelficarra](https://github.com/michaelficarra)) | ||
| 123 | + * Mark Pedrotti ([@pedrottimark](https://github.com/pedrottimark)) | ||
| 124 | + * Oleg Gaidarenko ([@markelog](https://github.com/markelog)) | ||
| 125 | + * Mike Sherov [@mikesherov](https://github.com/mikesherov)) | ||
| 126 | + * Henry Zhu ([@hzoo](https://github.com/hzoo)) | ||
| 127 | + * Marat Dulin ([@mdevils](https://github.com/mdevils)) | ||
| 128 | + * Alexej Yaroshevich ([@zxqfox](https://github.com/zxqfox)) | ||
| 129 | + | ||
| 130 | + ### Issues Team | ||
| 131 | + | ||
| 132 | + * Kevin Partington ([@platinumazure](https://github.com/platinumazure)) | ||
| 133 | + * Vitor Balocco ([@vitorbal](https://github.com/vitorbal)) | ||
| 93 | 134 | ||
| 94 | 135 | ## Releases | |
| 95 | 136 | ||
@@ -104,15 +145,35 @@ Before filing an issue, please be sure to read the guidelines for what you're re | |||
| 104 | 145 | * [Proposing a Rule Change](http://eslint.org/docs/developer-guide/contributing/rule-changes) | |
| 105 | 146 | * [Request a Change](http://eslint.org/docs/developer-guide/contributing/changes) | |
| 106 | 147 | ||
| 107 | - ## Frequently Asked Questions | ||
| 108 | - | ||
| 109 | - ### Why don't you like JSHint??? | ||
| 148 | + ## Semantic Versioning Policy | ||
| 149 | + | ||
| 150 | + ESLint follows [semantic versioning](http://semver.org). However, due to the nature of ESLint as a code quality tool, it's not always clear when a minor or major version bump occurs. To help clarify this for everyone, we've defined the following semantic versioning policy for ESLint: | ||
| 151 | + | ||
| 152 | + * Patch release (intended to not break your lint build) | ||
| 153 | + * A bug fix in a rule that results in ESLint reporting fewer errors. | ||
| 154 | + * A bug fix to the CLI or core (including formatters). | ||
| 155 | + * Improvements to documentation. | ||
| 156 | + * Non-user-facing changes such as refactoring code, adding, deleting, or modifying tests, and increasing test coverage. | ||
| 157 | + * Re-releasing after a failed release (i.e., publishing a release that doesn't work for anyone). | ||
| 158 | + * Minor release (might break your lint build) | ||
| 159 | + * A bug fix in a rule that results in ESLint reporting more errors. | ||
| 160 | + * A new rule is created. | ||
| 161 | + * A new option to an existing rule is created. | ||
| 162 | + * An existing rule is deprecated. | ||
| 163 | + * A new CLI capability is created. | ||
| 164 | + * New capabilities to the public API are added (new classes, new methods, new arguments to existing methods, etc.). | ||
| 165 | + * A new formatter is created. | ||
| 166 | + * Major release (likely to break your lint build) | ||
| 167 | + * `eslint:recommended` is updated. | ||
| 168 | + * An existing rule is removed. | ||
| 169 | + * An existing formatter is removed. | ||
| 170 | + * Part of the public API is removed or changed in an incompatible way. | ||
| 110 | 171 | ||
| 111 | - I do like JSHint. And I like Anton and Rick. Neither of those were deciding factors in creating this tool. The fact is that I've had a dire need for a JavaScript tool with pluggable linting rules. I had hoped JSHint would be able to do this, however after chatting with Anton, I found that the planned plugin infrastructure wasn't going to suit my purpose. | ||
| 172 | + ## Frequently Asked Questions | ||
| 112 | 173 | ||
| 113 | - ### I'm not giving up JSHint for this! | ||
| 174 | + ### How is ESLint different from JSHint? | ||
| 114 | 175 | ||
| 115 | - That's not really a question, but I got it. I'm not trying to convince you that ESLint is better than JSHint. The only thing I know is that ESLint is better than JSHint for what I'm doing. In the off chance you're doing something similar, it might be better for you. Otherwise, keep using JSHint, I'm certainly not going to tell you to stop using it. | ||
| 176 | + The most significant difference is that ESlint has pluggable linting rules. That means you can use the rules it comes with, or you can extend it with rules created by others or by yourself! | ||
| 116 | 177 | ||
| 117 | 178 | ### How does ESLint performance compare to JSHint? | |
| 118 | 179 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -77,16 +77,4 @@ if (useStdIn) { | |||
| 77 | 77 | exitCode = cli.execute(process.argv); | |
| 78 | 78 | } | |
| 79 | 79 | ||
| 80 | - // https://github.com/eslint/eslint/issues/4691 | ||
| 81 | - // In Node.js >= 0.12, you can use a cleaner way | ||
| 82 | - if ("exitCode" in process) { | ||
| 83 | - process.exitCode = exitCode; | ||
| 84 | - } else { | ||
| 85 | - /* | ||
| 86 | - * Wait for the stdout buffer to drain. | ||
| 87 | - * See https://github.com/eslint/eslint/issues/317 | ||
| 88 | - */ | ||
| 89 | - process.on("exit", function() { | ||
| 90 | - process.exit(exitCode); | ||
| 91 | - }); | ||
| 92 | - } | ||
| 80 | + process.exitCode = exitCode; | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -5,8 +5,6 @@ | |||
| 5 | 5 | ||
| 6 | 6 | "use strict"; | |
| 7 | 7 | ||
| 8 | - var DEFAULT_PARSER = require("../conf/eslint.json").parser; | ||
| 9 | - | ||
| 10 | 8 | module.exports = { | |
| 11 | 9 | configFile: null, | |
| 12 | 10 | baseConfig: false, | |
@@ -18,8 +16,9 @@ module.exports = { | |||
| 18 | 16 | extensions: [".js"], | |
| 19 | 17 | ignore: true, | |
| 20 | 18 | ignorePath: null, | |
| 21 | - parser: DEFAULT_PARSER, | ||
| 19 | + parser: "", // must be empty | ||
| 22 | 20 | cache: false, | |
| 21 | + | ||
| 23 | 22 | // in order to honor the cacheFile option if specified | |
| 24 | 23 | // this option should not have a default value otherwise | |
| 25 | 24 | // it will always be used | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -0,0 +1,29 @@ | |||
| 1 | + /** | ||
| 2 | + * @fileoverview Config to enable all rules. | ||
| 3 | + * @author Robert Fletcher | ||
| 4 | + */ | ||
| 5 | + | ||
| 6 | + "use strict"; | ||
| 7 | + | ||
| 8 | + //------------------------------------------------------------------------------ | ||
| 9 | + // Requirements | ||
| 10 | + //------------------------------------------------------------------------------ | ||
| 11 | + | ||
| 12 | + var fs = require("fs"), | ||
| 13 | + path = require("path"); | ||
| 14 | + | ||
| 15 | + //------------------------------------------------------------------------------ | ||
| 16 | + // Helpers | ||
| 17 | + //------------------------------------------------------------------------------ | ||
| 18 | + | ||
| 19 | + var ruleFiles = fs.readdirSync(path.resolve(__dirname, "../lib/rules")); | ||
| 20 | + var enabledRules = ruleFiles.reduce(function(result, filename) { | ||
| 21 | + result[path.basename(filename, ".js")] = "error"; | ||
| 22 | + return result; | ||
| 23 | + }, {}); | ||
| 24 | + | ||
| 25 | + //------------------------------------------------------------------------------ | ||
| 26 | + // Public Interface | ||
| 27 | + //------------------------------------------------------------------------------ | ||
| 28 | + | ||
| 29 | + module.exports = { rules: enabledRules }; | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -19,9 +19,9 @@ | |||
| 19 | 19 | "no-debugger": "error", | |
| 20 | 20 | "no-delete-var": "error", | |
| 21 | 21 | "no-div-regex": "off", | |
| 22 | + "no-dupe-args": "error", | ||
| 22 | 23 | "no-dupe-class-members": "error", | |
| 23 | 24 | "no-dupe-keys": "error", | |
| 24 | - "no-dupe-args": "error", | ||
| 25 | 25 | "no-duplicate-case": "error", | |
| 26 | 26 | "no-duplicate-imports": "off", | |
| 27 | 27 | "no-else-return": "off", | |
@@ -55,13 +55,14 @@ | |||
| 55 | 55 | "no-lone-blocks": "off", | |
| 56 | 56 | "no-lonely-if": "off", | |
| 57 | 57 | "no-loop-func": "off", | |
| 58 | + "no-magic-numbers": "off", | ||
| 59 | + "no-mixed-operators": "off", | ||
| 58 | 60 | "no-mixed-requires": "off", | |
| 59 | 61 | "no-mixed-spaces-and-tabs": "error", | |
| 60 | - "linebreak-style": "off", | ||
| 61 | 62 | "no-multi-spaces": "off", | |
| 62 | 63 | "no-multi-str": "off", | |
| 63 | 64 | "no-multiple-empty-lines": "off", | |
| 64 | - "no-native-reassign": "off", | ||
| 65 | + "no-native-reassign": "error", | ||
| 65 | 66 | "no-negated-condition": "off", | |
| 66 | 67 | "no-negated-in-lhs": "error", | |
| 67 | 68 | "no-nested-ternary": "off", | |
@@ -80,6 +81,7 @@ | |||
| 80 | 81 | "no-process-env": "off", | |
| 81 | 82 | "no-process-exit": "off", | |
| 82 | 83 | "no-proto": "off", | |
| 84 | + "no-prototype-builtins": "off", | ||
| 83 | 85 | "no-redeclare": "error", | |
| 84 | 86 | "no-regex-spaces": "error", | |
| 85 | 87 | "no-restricted-globals": "off", | |
@@ -109,7 +111,7 @@ | |||
| 109 | 111 | "no-unmodified-loop-condition": "off", | |
| 110 | 112 | "no-unneeded-ternary": "off", | |
| 111 | 113 | "no-unreachable": "error", | |
| 112 | - "no-unsafe-finally": "off", | ||
| 114 | + "no-unsafe-finally": "error", | ||
| 113 | 115 | "no-unused-expressions": "off", | |
| 114 | 116 | "no-unused-labels": "error", | |
| 115 | 117 | "no-unused-vars": "error", | |
@@ -119,11 +121,11 @@ | |||
| 119 | 121 | "no-useless-concat": "off", | |
| 120 | 122 | "no-useless-constructor": "off", | |
| 121 | 123 | "no-useless-escape": "off", | |
| 124 | + "no-useless-rename": "off", | ||
| 122 | 125 | "no-void": "off", | |
| 123 | 126 | "no-var": "off", | |
| 124 | 127 | "no-warning-comments": "off", | |
| 125 | 128 | "no-with": "off", | |
| 126 | - "no-magic-numbers": "off", | ||
| 127 | 129 | "array-bracket-spacing": "off", | |
| 128 | 130 | "array-callback-return": "off", | |
| 129 | 131 | "arrow-body-style": "off", | |
@@ -135,10 +137,10 @@ | |||
| 135 | 137 | "brace-style": "off", | |
| 136 | 138 | "callback-return": "off", | |
| 137 | 139 | "camelcase": "off", | |
| 138 | - "comma-dangle": "error", | ||
| 140 | + "comma-dangle": "off", | ||
| 139 | 141 | "comma-spacing": "off", | |
| 140 | 142 | "comma-style": "off", | |
| 141 | - "complexity": ["off", 11], | ||
| 143 | + "complexity": "off", | ||
| 142 | 144 | "computed-property-spacing": "off", | |
| 143 | 145 | "consistent-return": "off", | |
| 144 | 146 | "consistent-this": "off", | |
@@ -155,15 +157,19 @@ | |||
| 155 | 157 | "global-require": "off", | |
| 156 | 158 | "guard-for-in": "off", | |
| 157 | 159 | "handle-callback-err": "off", | |
| 160 | + "id-blacklist": "off", | ||
| 158 | 161 | "id-length": "off", | |
| 162 | + "id-match": "off", | ||
| 159 | 163 | "indent": "off", | |
| 160 | 164 | "init-declarations": "off", | |
| 161 | 165 | "jsx-quotes": "off", | |
| 162 | 166 | "key-spacing": "off", | |
| 163 | 167 | "keyword-spacing": "off", | |
| 168 | + "linebreak-style": "off", | ||
| 164 | 169 | "lines-around-comment": "off", | |
| 165 | 170 | "max-depth": "off", | |
| 166 | 171 | "max-len": "off", | |
| 172 | + "max-lines": "off", | ||
| 167 | 173 | "max-nested-callbacks": "off", | |
| 168 | 174 | "max-params": "off", | |
| 169 | 175 | "max-statements": "off", | |
@@ -173,7 +179,9 @@ | |||
| 173 | 179 | "newline-after-var": "off", | |
| 174 | 180 | "newline-before-return": "off", | |
| 175 | 181 | "newline-per-chained-call": "off", | |
| 182 | + "object-curly-newline": "off", | ||
| 176 | 183 | "object-curly-spacing": ["off", "never"], | |
| 184 | + "object-property-newline": "off", | ||
| 177 | 185 | "object-shorthand": "off", | |
| 178 | 186 | "one-var": "off", | |
| 179 | 187 | "one-var-declaration-per-line": "off", | |
@@ -189,14 +197,13 @@ | |||
| 189 | 197 | "quote-props": "off", | |
| 190 | 198 | "quotes": "off", | |
| 191 | 199 | "radix": "off", | |
| 192 | - "id-match": "off", | ||
| 193 | - "id-blacklist": "off", | ||
| 194 | 200 | "require-jsdoc": "off", | |
| 195 | - "require-yield": "off", | ||
| 201 | + "require-yield": "error", | ||
| 202 | + "rest-spread-spacing": "off", | ||
| 196 | 203 | "semi": "off", | |
| 197 | 204 | "semi-spacing": "off", | |
| 198 | - "sort-vars": "off", | ||
| 199 | 205 | "sort-imports": "off", | |
| 206 | + "sort-vars": "off", | ||
| 200 | 207 | "space-before-blocks": "off", | |
| 201 | 208 | "space-before-function-paren": "off", | |
| 202 | 209 | "space-in-parens": "off", | |
@@ -205,6 +212,7 @@ | |||
| 205 | 212 | "spaced-comment": "off", | |
| 206 | 213 | "strict": "off", | |
| 207 | 214 | "template-curly-spacing": "off", | |
| 215 | + "unicode-bom": "off", | ||
| 208 | 216 | "use-isnan": "error", | |
| 209 | 217 | "valid-jsdoc": "off", | |
| 210 | 218 | "valid-typeof": "error", | |
| Back | FazBrowse Home | New Git URL |
0 commit comments