2 title: Migrating to v1.0.0
6 ESLint v1.0.0 is the first major version release. As a result, there are some significant changes between how ESLint worked during its life in 0.x and how it will work going forward. These changes are the direct result of feedback from the ESLint community of users and were not made without due consideration for the upgrade path. We believe that these changes make ESLint even better, and while some work is necessary to upgrade, we hope the pain of this upgrade is small enough that you will see the benefit of upgrading.
8 ## All Rules Off by Default
10 The most important difference in v1.0.0 is that all rules are off by default. We made this change after numerous requests to allow turning off the default rules from within configuration files. While that wasn't technically feasible, it was feasible to have all rules off by default and then re-enable rules in configuration files using `extends`. As such, we've made the `--reset` behavior the default and removed this command line option.
12 When using `--init`, your configuration file will automatically include the following line:
16 "extends": "eslint:recommended"
20 This setting mimics some of the default behavior from 0.x, but not all. If you don't want to use any of the recommended rules, you can delete this line.
22 **To address:** If you are currently using `--reset`, then you should stop passing `--reset` on the command line; no other changes are necessary. If you are not using `--reset`, then you should review your configuration to determine which rules should be on by default. You can partially restore some of the default behavior by adding the following to your configuration file:
24 The `"eslint:recommended"` configuration contains many of the same default rule settings from 0.x, but not all. These rules are no longer on by default, so you should review your settings to ensure they are still as you expect:
26 * [no-alert](../rules/no-alert)
27 * [no-array-constructor](../rules/no-array-constructor)
28 * [no-caller](../rules/no-caller)
29 * [no-catch-shadow](../rules/no-catch-shadow)
30 * [no-empty-label](../rules/no-empty-label)
31 * [no-eval](../rules/no-eval)
32 * [no-extend-native](../rules/no-extend-native)
33 * [no-extra-bind](../rules/no-extra-bind)
34 * [no-extra-strict](../rules/no-extra-strict)
35 * [no-implied-eval](../rules/no-implied-eval)
36 * [no-iterator](../rules/no-iterator)
37 * [no-label-var](../rules/no-label-var)
38 * [no-labels](../rules/no-labels)
39 * [no-lone-blocks](../rules/no-lone-blocks)
40 * [no-loop-func](../rules/no-loop-func)
41 * [no-multi-spaces](../rules/no-multi-spaces)
42 * [no-multi-str](../rules/no-multi-str)
43 * [no-native-reassign](../rules/no-native-reassign)
44 * [no-new](../rules/no-new)
45 * [no-new-func](../rules/no-new-func)
46 * [no-new-object](../rules/no-new-object)
47 * [no-new-wrappers](../rules/no-new-wrappers)
48 * [no-octal-escape](../rules/no-octal-escape)
49 * [no-process-exit](../rules/no-process-exit)
50 * [no-proto](../rules/no-proto)
51 * [no-return-assign](../rules/no-return-assign)
52 * [no-script-url](../rules/no-script-url)
53 * [no-sequences](../rules/no-sequences)
54 * [no-shadow](../rules/no-shadow)
55 * [no-shadow-restricted-names](../rules/no-shadow-restricted-names)
56 * [no-spaced-func](../rules/no-spaced-func)
57 * [no-trailing-spaces](../rules/no-trailing-spaces)
58 * [no-undef-init](../rules/no-undef-init)
59 * [no-underscore-dangle](../rules/no-underscore-dangle)
60 * [no-unused-expressions](../rules/no-unused-expressions)
61 * [no-use-before-define](../rules/no-use-before-define)
62 * [no-with](../rules/no-with)
63 * [no-wrap-func](../rules/no-wrap-func)
64 * [camelcase](../rules/camelcase)
65 * [comma-spacing](../rules/comma-spacing)
66 * [consistent-return](../rules/consistent-return)
67 * [curly](../rules/curly)
68 * [dot-notation](../rules/dot-notation)
69 * [eol-last](../rules/eol-last)
70 * [eqeqeq](../rules/eqeqeq)
71 * [key-spacing](../rules/key-spacing)
72 * [new-cap](../rules/new-cap)
73 * [new-parens](../rules/new-parens)
74 * [quotes](../rules/quotes)
75 * [semi](../rules/semi)
76 * [semi-spacing](../rules/semi-spacing)
77 * [space-infix-ops](../rules/space-infix-ops)
78 * [space-return-throw-case](../rules/space-return-throw-case)
79 * [space-unary-ops](../rules/space-unary-ops)
80 * [strict](../rules/strict)
81 * [yoda](../rules/yoda)
83 See also: the [full diff](https://github.com/eslint/eslint/commit/e3e9dbd9876daf4bdeb4e15f8a76a9d5e6e03e39#diff-b01a5cfd9361ca9280a460fd6bb8edbbL1) where the defaults were changed.
85 Here's a configuration file with the closest equivalent of the old defaults:
89 "extends": "eslint:recommended",
92 "no-array-constructor": 2,
97 "no-extend-native": 2,
105 "no-multi-spaces": 2,
107 "no-native-reassign": 2,
111 "no-new-wrappers": 2,
112 "no-octal-escape": 2,
113 "no-process-exit": 2,
115 "no-return-assign": 2,
119 "no-shadow-restricted-names": 2,
121 "no-trailing-spaces": 2,
123 "no-underscore-dangle": 2,
124 "no-unused-expressions": 2,
125 "no-use-before-define": 2,
129 "consistent-return": 2,
131 "dot-notation": [2, { "allowKeywords": true }],
133 "no-extra-parens": [2, "functions"],
135 "key-spacing": [2, { "beforeColon": false, "afterColon": true }],
138 "quotes": [2, "double"],
140 "semi-spacing": [2, {"before": false, "after": true}],
141 "space-infix-ops": 2,
142 "space-return-throw-case": 2,
143 "space-unary-ops": [2, { "words": true, "nonwords": false }],
144 "strict": [2, "function"],
152 Over the past several releases, we have been deprecating rules and introducing new rules to take their place. The following is a list of the removed rules and their replacements:
154 * [generator-star](../rules/generator-star) is replaced by [generator-star-spacing](../rules/generator-star-spacing)
155 * [global-strict](../rules/global-strict) is replaced by [strict](../rules/strict)
156 * [no-comma-dangle](../rules/no-comma-dangle) is replaced by [comma-dangle](../rules/comma-dangle)
157 * [no-empty-class](../rules/no-empty-class) is replaced by [no-empty-character-class](../rules/no-empty-character-class)
158 * [no-extra-strict](../rules/no-extra-strict) is replaced by [strict](../rules/strict)
159 * [no-reserved-keys](../rules/no-reserved-keys) is replaced by [quote-props](../rules/quote-props)
160 * [no-space-before-semi](../rules/no-space-before-semi) is replaced by [semi-spacing](../rules/semi-spacing)
161 * [no-wrap-func](../rules/no-wrap-func) is replaced by [no-extra-parens](../rules/no-extra-parens)
162 * [space-after-function-name](../rules/space-after-function-name) is replaced by [space-before-function-paren](../rules/space-before-function-paren)
163 * [space-before-function-parentheses](../rules/space-before-function-parentheses) is replaced by [space-before-function-paren](../rules/space-before-function-paren)
164 * [space-in-brackets](../rules/space-in-brackets) is replaced by[object-curly-spacing](../rules/object-curly-spacing) and [array-bracket-spacing](../rules/array-bracket-spacing)
165 * [space-unary-word-ops](../rules/space-unary-word-ops) is replaced by [space-unary-ops](../rules/space-unary-ops)
166 * [spaced-line-comment](../rules/spaced-line-comment) is replaced by [spaced-comment](../rules/spaced-comment)
168 **To address:** You'll need to update your rule configurations to use the new rules. ESLint v1.0.0 will also warn you when you're using a rule that has been removed and will suggest the replacement rules. Hopefully, this will result in few surprises during the upgrade process.
170 ## Column Numbers are 1-based
172 From the beginning, ESLint has reported errors using 0-based columns because that's what Esprima, and later Espree, reported. However, most tools and editors use 1-based columns, which made for some tricky integrations with ESLint. In v1.0.0, we've switched over to reporting errors using 1-based columns to fall into line with the tools developers use everyday.
174 **To address:** If you've created an editor integration, or a tool that had to correct the column number, you'll need to update to just pass through the column number from ESLint. Otherwise, no change is necessary.
176 ## No Longer Exporting cli
178 In 0.x, the `cli` object was exported for use by external tools. It was later deprecated in favor of `CLIEngine`. In v1.0.0, we are no longer exporting `cli` as it should not be used by external tools. This will break existing tools that make use of it.
180 **To address:** If you are using the exported `cli` object, switch to using `CLIEngine` instead.
182 ## Deprecating eslint-tester
184 The `eslint-tester` module, which has long been the primary tester for ESLint rules, has now been moved into the `eslint` module. This was the result of a difficult relationship between these two modules that created circular dependencies and was causing a lot of problems in rule tests. Moving the tester into the `eslint` module fixed a lot of those issues.
186 The replacement for `eslint-tester` is called `RuleTester`. It's a simplified version of `ESLintTester` that's designed to work with any testing framework. This object is exposed by the package.
188 **To address:** Convert all of your rule tests to use `RuleTester`. If you have this as a test using `ESLintTester`:
191 var eslint = require("../../../lib/eslint"),
192 ESLintTester = require("eslint-tester");
194 var eslintTester = new ESLintTester(eslint);
195 eslintTester.addRuleTest("lib/rules/your-rule", {
201 Then you can change to:
204 var rule = require("../../../lib/rules/your-rule"),
205 RuleTester = require("eslint").RuleTester;
207 var ruleTester = new RuleTester();
208 ruleTester.run("your-rule", rule, {