Highlights
Here are some highlights of changes in this release.
Autofixing of more rules
ESLint v1.5.0 introduces several more autofixing rules to use with the --fix
command line argument. In this release, we have implemented autofixing in these rules:
eol-last
indent
no-extra-semi
no-spaced-func
no-trailing-spaces
space-after-keywords
space-before-blocks
space-before-keywords
space-infix-ops
space-return-throw-case
space-before-function-paren
When you run ESLint on the command line with the --fix
flag, it will automatically fix any problems that it can (not all problems are fixable at once) and will not report the problems that were fixed.
This feature is still considered experimental but is backed up by a lot of unit tests verifying correctness. Still, we expect to find some edge cases that we didn’t anticipate, so we’d appreciate your feedback.
Limitations: the --fix
flag does not work for piped-in text and has no effect on code that uses ESLint processors.
–debug Flag
Sometimes ESLint doesn’t do what it’s supposed to do, and in that case, the new --debug
flag can help. When using this flag, the command line will output debug information to the console, allowing you to see what ESLint is doing and providing valuable information to determine if there’s a bug. We may ask for the debug information when you report a possible bug.
Features
- New: Add --debug flag to CLI (fixes #2692) (Nicholas C. Zakas)
Enhancements
- Update:
key-spacing
should allow 1+ around colon (fixes #3363) (Burak Yigit Kaya) - Update: Add configuration option to
space-before-blocks
(fixes #3758) (Phil Vargas) - Update: auto fix for space-before-function-paren rule (fixes #3766) (alberto)
- Update: Implement auto fix for
eol-last
rule (fixes #3725) (Gyandeep Singh) - Update: Implement auto fix for
indent
rule (fixes #3734) (Gyandeep Singh) - Update: Implement auto fix for
no-extra-semi
rule (fixes #3745) (Gyandeep Singh) - Update: Implement auto fix for
no-spaced-func
rule (fixes #3728) (Gyandeep Singh) - Update: Implement auto fix for
no-trailing-spaces
rule (fixes #3723) (Gyandeep Singh) - Update: Implement auto fix for
space-after-keywords
rule (fixes #3773) (Gyandeep Singh) - Update: Implement auto fix for
space-before-blocks
rule (fixes #3776) (Gyandeep Singh) - Update: Implement auto fix for
space-before-keywords
rule (fixes #3771) (Gyandeep Singh) - Update: Implement auto fix for
space-infix-ops
rule (fixes #3801) (Gyandeep Singh) - Update: Implement auto fix for
space-return-throw-case
(fixes #3732) (Gyandeep Singh) - Update: Refactors the traversing logic (refs #3530) (Toru Nagashima)
Bug Fixes
- Fix:
comma-dangle
had not been checking imports/exports (fixes #3794) (Toru Nagashima) - Fix:
no-warning-comments
can’t be set via config comment (fixes #3619) (Burak Yigit Kaya) - Fix:
semi-spacing
had conflicted withblock-spacing
(fixes #3721) (Toru Nagashima) - Fix:
space-before-blocks
had conflictedarrow-spacing
(fixes #3769) (Toru Nagashima) - Fix:
space-before-keywords
fails to handle some cases (fixes #3756) (Marko Raatikka) - Fix: Directory ignoring should work (fixes #3812) (Nicholas C. Zakas)
- Fix: Ensure **/node_modules works in ignore files (fixes #3788) (Nicholas C. Zakas)
- Fix: Ensure ./ works correctly with CLI (fixes #3792) (Nicholas C. Zakas)
- Fix: env-specified ecmaFeatures had been wrong (fixes #3735) (Toru Nagashima)
- Fix: false alarm of semi-spacing with semi set to never (fixes #1983) (Chen Yicai)
- Fix: function body indent issues (fixes #3614, fixes #3799) (Gyandeep Singh)
- Fix: invalidate cache when config changes. (fixes #3770) (royriojas)
- Fix: jsx-quotes exception for attributes without value (fixes #3793) (Mathias Schreck)
- Fix: space checking between tokens (fixes #2211) (Nicholas C. Zakas)
- Fix: tests fail due to differences in temporary paths. (fixes #3778) (royriojas)
Documentation
- Docs: Add if-else example (fixes #3722) (Ian VanSchooten)
- Docs: add more examples + tests for block-scoped-var (fixes #3791) (JT)
- Docs: Change example wording from warnings to problems (fixes #3676) (Ian VanSchooten)
- Docs: Clarify node types in no-multi-spaces (fixes #3781) (Nicholas C. Zakas)
- Docs: Fix closing code fence on cli docs (Ian VanSchooten)
- Docs: Update new-cap docs (fixes #3798) (Nicholas C. Zakas)
- Docs: Update no-undef-init docs (fixes #3170) (Nicholas C. Zakas)
- Docs: Update no-unused-expressions docs (fixes #3685) (Nicholas C. Zakas)
Build Related
- Build: Generate formatter example docs (fixes #3560) (Ian VanSchooten)