Standard v10.0.0 Release Notes
Release Date: 2017-04-04 // about 7 years ago-
standard
just turned 10.0.0! ๐๐ As with every new major release, there are lots of new rules in 10.0.0 designed to help catch bugs and make programmer intent more explicit.
standard
is more popular than ever โ 330,000 downloads per month! It's even more popular โ 670,000 downloads per month โ if you include the ๐ shareable ESLint config that we also publish.๐ The most important change in 10.0.0 is that using deprecated Node.js APIs is now โก๏ธ considered an error. It's finally time to update those dusty old APIs!
๐ Deprecated APIs are problematic because they may print warning messages in the console in recent versions of Node.js. This often confuses users and leads to ๐ unnecessary support tickets for project maintainers.
๐ Some deprecated APIs are even insecure (or at least prone to incorrect usage) which ๐ can have serious security implications. For that reason,
standard
now considers usage ofBuffer(num)
to be an error, since this function returns uninitialized program memory which could contain confidential information like passwords or keys.Instead of
Buffer(num)
, consider usingBuffer.alloc(num)
orBuffer.from(obj)
which make the programmer's intent clearer. These functions exist in all currently ๐ supported versions of Node.js, including Node.js 4.x. For more background, ๐ see this Node.js issue.๐ We also improved some rules to support common patterns in code bases that use React, JSX, and Flow.
โฌ๏ธ When you upgrade, consider running
standard --fix
to automatically fix some of the issues caught by this new version.๐ New features
- โก๏ธ Update ESLint from 3.15.x to 3.19.x.
- ๐ Node.js API: Add
standard.lintTextSync
method
๐ New rules
โ (Estimated % of affected standard users, based on test suite in parens)
- ๐ Disallow using deprecated Node.js APIs (node/no-deprecated-api) #693 [13%]
- Ensures that code always runs without warnings on the latest versions of Node.js
- Ensures that safe Buffer methods (
Buffer.from()
,Buffer.alloc()
) are used instead ofBuffer()
- ๐
Enforce callbacks always called with Node.js-style error first (standard/no-callback-literal) #623 [3%]
- Functions named
callback
orcb
must be invoked withnull
,undefined
, or anError
as the first argument - Disallows using a string instead of an
Error
object - Disallows confusing callbacks that do not follow the standard Node.js pattern
- Functions named
- ๐ Disallow any imports that come after non-import statements (import/first) #806 [1%]
- ๐ Disallow unnecessary return await (no-return-await) #695 [0%]
- ๐ Disallow comma-dangle in functions (comma-dangle) #787 [0%]
- ๐ Disallow repeated exports of names or defaults (import/export) #806 [0%]
- ๐ Disallow import of modules using absolute paths (import/no-absolute-path) #806 [0%]
- ๐ Disallow Webpack loader syntax in imports (import/no-webpack-loader-syntax) #806 [0%]
- ๐ Disallow comparing against -0 (no-compare-neg-zero) #812 [0%]
๐ Changed rules
- ๐ Relax rule: allow using
...rest
to omit properties from an object (no-unused-vars) #800- This is a common and useful pattern in React/JSX apps!
- ๐ Relax rule: allow Flow
import type
statements (import/no-duplicates) #599- These are no longer considered to be "duplicate imports"
- ๐ Relax rule: Treat
process.exit()
the same asthrow
in code path analysis (node/process-exit-as-throw) #699- Makes certain other rules work better and give fewer false positives
- ๐ Relax rule: allow Unnecessary Labels (no-extra-label)
- Redundant, since "no-labels" is already enabled, which is more restrictive