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 of Buffer(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 using Buffer.alloc(num) or Buffer.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 of Buffer()
    • ๐Ÿ’… Enforce callbacks always called with Node.js-style error first (standard/no-callback-literal) #623 [3%]
      • Functions named callback or cb must be invoked with null, undefined, or an Error 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
    • ๐Ÿ‘• 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 as throw 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