Skip to content

Commit

Permalink
Merge pull request #1586 from standard/warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
feross committed Oct 31, 2020
2 parents f594a54 + 15754e6 commit 447ddae
Show file tree
Hide file tree
Showing 4 changed files with 180 additions and 245 deletions.
39 changes: 34 additions & 5 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,32 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [16.0.1] - 2020-10-30

- Introduce "warning" system for disruptive rules (read more below)
- Change rule to a "warning": Require let or const instead of var ([no-var](https://eslint.org/docs/rules/no-var)) [#633](https://github.com/standard/standard/issues/633)

`standard` treats all rule violations as errors, which means that `standard`
will exit with a non-zero (error) exit code.

However, we may occasionally release a new major version of `standard`
which changes a rule that affects the majority of `standard` users (for example,
transitioning from `var` to `let`/`const`). We do this only when we think the
advantage is worth the cost and only when the rule is
[auto-fixable](https://standardjs.com/#is-there-an-automatic-formatter).

In these situations, we have a "transition period" where the rule change is only
a "warning". Warnings don't cause `standard` to return a non-zero (error)
exit code. However, a warning message will still print to the console. During
the transition period, `using standard --fix` will update your code so that it's
ready for the next major version.

The slow and careful approach is what we strive for with `standard`. We're
generally extremely conservative in enforcing the usage of new language
features. We want using `standard` to be light and fun and so we're careful
about making changes that may get in your way. As always, you can
[disable a rule](https://standardjs.com/#how-do-i-disable-a-rule) at any time, if necessary.

## [16.0.0] - 2020-10-28

We're super excited to announce `standard` 16!
Expand All @@ -26,10 +52,10 @@ code to match the newly added rules.

- 馃専 Support the `.gitignore` ignore syntax from the command line [#1117](https://github.com/standard/standard/issues/1117)
- In older versions, the command `standard src` would not lint the `src/` folder
- Instead, a glob pattern needed like `standard src/**/*.js` was required
- Instead, a glob pattern like `standard src/**/*.js` was required
- This is now fixed! You can run `standard src` to lint the `src/` folder!

- 馃専 Support relative paths from the command line (e.g. `standard ../src/*.js`) [#1384](https://github.com/standard/standard/issues/1384)
- 馃専 Support relative paths from the command line in more situations (e.g. `standard ../src/*.js`) [#1384](https://github.com/standard/standard/issues/1384)

- 馃専 New `extensions` option for linting additional extensions besides `.js`, `.jsx`, `.mjs`, and `.cjs`
- Can be configured with the `--ext` command line flag or in `package.json`:
Expand All @@ -47,13 +73,14 @@ code to match the newly added rules.
}
```

- 馃専 New cache directory location, respecting `XDG_CACHE_HOME` preference, with fallback to `~/.cache/standard` [standard-engine/#214](https://github.com/standard/standard-engine/pull/214)

### Changed features

- Update `eslint` from `~7.11.0` to `~7.12.1`

- Update `standard-engine` from `^12` to `^14`
- Fix inaccurate `--help` command which indicates that `bundle.js` is automatically ignored when it is not [standard-engine/#224](https://github.com/standard/standard-engine/pull/224)
- New cache directory location, respecting `XDG_CACHE_HOME` preference, with fallback to `~/.cache/standard` [standard-engine/#214](https://github.com/standard/standard-engine/pull/214)
- Fix inaccurate `--help` command which indicates that `bundle.js` is automatically ignored when it is not anymore [standard-engine/#224](https://github.com/standard/standard-engine/pull/224)
- Remove `deglob` package and use built-in ESLint folder-traversal support

- Paths with square brackets (e.g. `[` and `]`) are no longer skipped [#1333](https://github.com/standard/standard/issues/1333)
Expand Down Expand Up @@ -1016,7 +1043,9 @@ In `package.json`, use the "standard" property:

[view diff](https://github.com/standard/standard/compare/v3.9.0...v4.0.0)

[unreleased]: https://github.com/standard/standard/compare/v16.0.0...HEAD
[unreleased]: https://github.com/standard/standard/compare/v16.0.1...HEAD

[16.0.1]: https://github.com/standard/standard/compare/v16.0.0...v16.0.1

[16.0.0]: https://github.com/standard/standard/compare/v15.0.1...v16.0.0

Expand Down
33 changes: 28 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,18 +59,18 @@ Give it a try by running `npx standard --fix` right now!
- [But this isn't a real web standard!](#but-this-isnt-a-real-web-standard)
- [Is there an automatic formatter?](#is-there-an-automatic-formatter)
- [How do I ignore files?](#how-do-i-ignore-files)
- [How do I hide a certain warning?](#how-do-i-hide-a-certain-warning)
- [How do I disable a rule?](#how-do-i-disable-a-rule)
- [I use a library that pollutes the global namespace. How do I prevent "variable is not defined" errors?](#i-use-a-library-that-pollutes-the-global-namespace-how-do-i-prevent-variable-is-not-defined-errors)
- [How do I use experimental JavaScript (ES Next) features?](#how-do-i-use-experimental-javascript-es-next-features)
- [Can I use a JavaScript language variant, like Flow or TypeScript?](#can-i-use-a-javascript-language-variant-like-flow-or-typescript)
- [What about Mocha, Jest, Jasmine, QUnit, etc?](#what-about-mocha-jest-jasmine-qunit-etc)
- [What about Web Workers and Service Workers?](#what-about-web-workers-and-service-workers)
- [What is the difference between warnings and errors?](#what-is-the-difference-between-warnings-and-errors)
- [Can I check code inside of Markdown or HTML files?](#can-i-check-code-inside-of-markdown-or-html-files)
- [Is there a Git `pre-commit` hook?](#is-there-a-git-pre-commit-hook)
- [How do I make the output all colorful and pretty?](#how-do-i-make-the-output-all-colorful-and-pretty)
- [Is there a Node.js API?](#is-there-a-nodejs-api)
- [How do I contribute to StandardJS?](#how-do-i-contribute-to-standardjs)
- [License](#license)

## Install

Expand Down Expand Up @@ -399,13 +399,13 @@ that, add a `standard.ignore` property to `package.json`:
}
```

## How do I hide a certain warning?
## How do I disable a rule?

In rare cases, you'll need to break a rule and hide the warning generated by
In rare cases, you'll need to break a rule and hide the error generated by
`standard`.

JavaScript Standard Style uses [ESLint](http://eslint.org/) under-the-hood and
you can hide warnings as you normally would if you used ESLint directly.
you can hide errors as you normally would if you used ESLint directly.

To get verbose output (so you can find the particular rule name to ignore), run:

Expand Down Expand Up @@ -633,6 +633,29 @@ For Service workers, add this instead:
/* eslint-env serviceworker */
```

## What is the difference between warnings and errors?

`standard` treats all rule violations as errors, which means that `standard`
will exit with a non-zero (error) exit code.

However, we may occasionally release a new major version of `standard`
which changes a rule that affects the majority of `standard` users (for example,
transitioning from `var` to `let`/`const`). We do this only when we think the
advantage is worth the cost and only when the rule is
[auto-fixable](#is-there-an-automatic-formatter).

In these situations, we have a "transition period" where the rule change is only
a "warning". Warnings don't cause `standard` to return a non-zero (error)
exit code. However, a warning message will still print to the console. During
the transition period, `using standard --fix` will update your code so that it's
ready for the next major version.

The slow and careful approach is what we strive for with `standard`. We're
generally extremely conservative in enforcing the usage of new language
features. We want using `standard` to be light and fun and so we're careful
about making changes that may get in your way. As always, you can
[disable a rule](#how-do-i-disable-a-rule) at any time, if necessary.

## Can I check code inside of Markdown or HTML files?

To check code inside Markdown files, use [`standard-markdown`](https://www.npmjs.com/package/standard-markdown).
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
},
"dependencies": {
"eslint": "~7.12.1",
"eslint-config-standard": "16.0.0",
"eslint-config-standard": "16.0.1",
"eslint-config-standard-jsx": "10.0.0",
"eslint-plugin-import": "~2.22.1",
"eslint-plugin-node": "~11.1.0",
Expand Down

0 comments on commit 447ddae

Please sign in to comment.