Releases: IIP-Design/eslint-config
Releases · IIP-Design/eslint-config
v1.6.1
Changed:
- Reverted changes applied in v1.6.0 to the
no-shadow
rule, which included checks forbuiltinGlobals
. We found this rule to be too restrictive and barred the use of several common variable names (such asname
,status
, andparent
). Rather than enumerating a list of exceptions, we opted to disable the rule.
Build:
- Update dependencies:
eslint
: 8.11.0 => 8.13.0eslint-plugin-import
: 2.25.4 => 2.26.0eslint-plugin-jest
: 26.1.1 => 26.1.4eslint-plugin-react
: 7.29.3 => 7.29.4eslint-plugin-react-hooks
: 4.3.0 => 4.4.0
v1.6.0
Added:
- New rules and options added to ESLint between 7.32.0 -> 8.11.0. Specifically:
no-unused-private-class-members
at the levelwarn
to indicate the presence of private methods that should probably be removed. (added v8.1.0)prefer-object-has-own
at the leveloff
. This rule favors the use ofObject.hasOwn()
overObject.prototype.hasOwnProperty.call()
a pattern we do not typically use. Furthermore, it is only relevant in an ES2020 context which some projects may not conform to. (added v8.5.0)- Set the new
enforceForClassFields
property onclass-methods-use-this
tofalse
to allow for arrow function class methods. - Set the new
onlyOneSimpleParam
property onno-confusing-arrow
to false. This explicitly chooses the current default behavior. - Set the new
destructuredArrayIgnorePattern
property onno-unused-vars
to^_
. This allows us to indicate unused array elements when destructuring with a leading underscore.
- New rules and options added to ESLint plugin React between 7.26.0 -> 7.29.3. Specifically:
react/no-arrow-function-lifecycle
to prevent the declaration of React class lifecycle methods as arrow functions, which can have performance implications. (added in v7.27.0 of eslint-plugin-react)react/no-invalid-html-attribute
which prevents the assignment of an invalid value to a number of attributes on native HTML elements. (added in v7.27.0 of eslint-plugin-react)react/no-unused-class-component-methods
to ensure that all methods declared in class components are used. (added in v7.27.0 of eslint-plugin-react)react/hook-use-state
to enforce the[value,setValue]
naming convention when destructuring the return from auseState
call. (added in v7.29.0 of eslint-plugin-react)react/iframe-missing-sandbox
to follow security best practices and require asandbox
property on iframe elements. (added in v7.29.0 of eslint-plugin-react)- Utilize the new
propElementValues
property onreact/jsx-curly-brace-presence
to ensure that when passing a JSX element as a prop, it is always surrounded by curly brackets. - Enable the new
warnOnDuplicates
property onreact/jsx-key
to detect non-unique keys in an array.
- Several existing plugin rules that had been omitted in previous versions of this configuration. Namely:
import/no-relative-packages
- set to the leveloff
since we do not currently use Yarn/Lerna workspaces, but included for the sake of completeness. (added in v2.23.0 of eslint-plugin-import)import/no-import-module-exports
- set to the leveloff
as it is unclear what impact stricter control would have on our codebase, but included for the sake of completeness. (added in v2.23.0 of eslint-plugin-import)jsx-a11y/autocomplete-valid
- set toerror
to ensure that the autocomplete attribute is only used with appropriate input elements. (added in v6.3.0 of eslint-plugin-jsx-a11y)
- An override to allow unpublished require statements in Webpack config files (identified by the filenames
webpack.*.js
).
Changed:
- Switched the ESLint config used by this repo to the standard version (as opposed to the Prettier-based version).
- Enable the
func-name-matching
rule, which was disabled. In practice we have been already following this rule. - Enable the
require-atomic-updates
rule at thewarn
level. As we deal with more asynchronous operations these sorts of bugs become more of a concern. - Use a stricter configuration of the
no-inner-declarations
rule disallowing variable declarations as well as function declarations. We typically use block boundlet
andconst
declarations so this may be a bit redundant, but it doesn't hurt. - Use a stricter configuration of the
no-shadow
rule by setting thebuiltinGlobals
property totrue
. This disables shadowing of global variables (ex.Object
andArray
).
Deprecated:
- The version of this configuration intended for use with Prettier has been deprecated (but not yet removed). The team disagreed with some of Prettier's firm held opinions and has hence phased out it's use. Allowed for the removal of the following, corresponding dependencies:
eslint-plugin-prettier
prettier
@gpa-lab/prettier-config
Build:
- Update all dependencies:
eslint
: 7.32.0 -> 8.11.0eslint-plugin-import
: 2.24.2 -> 2.25.4eslint-plugin-jest
: 24.4.3 -> 26.1.1eslint-plugin-jsx-a11y
: 6.4.1 -> 6.5.1eslint-plugin-react
: 7.26.0 -> 7.29.3eslint-plugin-react-hooks
: 4.2.0 -> 4.3.0jest
: 27.2.3 -> 27.5.1
v1.5.0
Added:
- New rules added to the ESLint React Plugin between 7.24.0 -> 7.26.0. Specifically:
react/prefer-exact-props
react/no-namespace
- Set the new
allowExpressions
property onreact/jsx-no-useless-fragment
tofalse
to disallow all fragments. - Set the new
allowLeadingUnderscore
property onreact/jsx-pascal-case
tofalse
to disallow component names staring with an underscore. - Set the new
links
andforms
properties to true to prevent usage of unsafetarget='_blank'
inside links and forms.
Build:
- Update all dependencies
v1.4.1
v1.4.0
Added:
- New rules added to ESLint between releases 7.8.1 -> 7.18.0. Specifically:
no-nonoctal-decimal-escape
no-unsafe-optional-chaining
- New rules added to the ESLint React Plugin between 7.20.6 -> 7.22.0. Specifically:
react/jsx-newline
react/jsx-no-constructed-context-values
Changed:
- Set the new
allow
property onreact/jsx-filename-extension
toas-needed
to prevent the use of the.jsx
file extension on files not using the JSX syntax. - Set the new
checkKeyMustBeforeSpread
property onreact/jsx-key
totrue
to enforce listing the JSX element key prior to spreading other props. This avoids a potential, unexpected createElement fallback. - Set the new
warnOnSpreadAttributes
property onreact/jsx-no-target-blank
totrue
. This ensures that the use oftarget="_blank"
withoutrel="noreferrer"
isn't missed even when spreading in props. - Switch the
allowAllCaps
property onreact/jsx-pascal-case
totrue
. - Add
@axe-core/react
,@testing-library/react
, andprop-types
as allowed modules innode/no-unpublished-import
. - Add
@next/bundle-analyzer
and@wordpress/scripts
as allowed modules innode/no-unpublished-require
. - Disable the
node/no-missing-import
rule. It overlaps with theimport/no-unresolved
rule and can cause problems when module aliasing.
Build:
- Update dependencies
v1.3.1
v1.3.0
Added:
- Node linting vis eslint-plugin-node
- New rules by ESLint between releases 6.8.0 -> 7.6.0. Specifically:
default-case-last
no-promise-executor-return
no-restricted-exports
no-unreachable-loop
no-useless-backreference
prefer-named-capture-group
- The
indent-legacy
rule to the deprecated list - Deprecated React rules to the deprecated list
- Unit tests for the eslint-plugin-node ruleset config
Changed:
- Disabled and deprecated all Node/CommonJS core rules due to deprecation by ESLint (replaced by eslint-plugin-node)
- Loosen the
no-extra-parens
to only apply to functions - Replace deprecated
id-blacklist
rule withid-denylist
- Updated unit tests to reflect base Node/CommonJS rule deprecation
Fixed:
- Removed options and replaced array notation with string notation for all disabled rules
v1.2.2
v1.2.1
Added:
- Documentation on the Cypress sub-package and Jest plugin to the readme
Changed:
- Move Jest rules out of shared config and into the default configuration
- Make Cypress package a complete ruleset extending the shared configuration
- Updated React and Jest plugins, Prettier config
- Use JSON rather than JavaScript example snippets in the readme since most GPA/LAB projects use an
.eslintrc
file rather than an.eslintrc.js
file
Fixed:
- Corrected the setting of
cypress/globals
as an available environment (previously set tocypress
which was undefined)
v1.2.0
Added:
- Jest and Cypress plugins with the recommended rules enabled
- Missing rule from React rule set
react/function-component-definition
set to both named and un-named declarations toarrow-function
Changed:
- Set
react-hooks/exhaustive-deps
to warn as recommended - Set
comma-dangle
toalways-multiline
to enforce a comma on the last item of a multiline array/object. Makes for more readable git diffs - Use
space-before-function-paren
to require space before parens for async arrow functions:async () => {}
rather thanasync() => {}
- Amend
indent
rule to enforce indentation of two spaces on switch cases - Updates dependencies
- Set default published NPM package access to public