Skip to content

Releases: IIP-Design/eslint-config

v1.6.1

19 Apr 13:33
97e7ed4
Compare
Choose a tag to compare

Changed:

  • Reverted changes applied in v1.6.0 to the no-shadow rule, which included checks for builtinGlobals. We found this rule to be too restrictive and barred the use of several common variable names (such as name, status, and parent). Rather than enumerating a list of exceptions, we opted to disable the rule.

Build:

  • Update dependencies:
    • eslint: 8.11.0 => 8.13.0
    • eslint-plugin-import: 2.25.4 => 2.26.0
    • eslint-plugin-jest: 26.1.1 => 26.1.4
    • eslint-plugin-react: 7.29.3 => 7.29.4
    • eslint-plugin-react-hooks: 4.3.0 => 4.4.0

v1.6.0

26 Mar 23:30
cf8340e
Compare
Choose a tag to compare

Added:

  • New rules and options added to ESLint between 7.32.0 -> 8.11.0. Specifically:
    • no-unused-private-class-members at the level warn to indicate the presence of private methods that should probably be removed. (added v8.1.0)
    • prefer-object-has-own at the level off. This rule favors the use of Object.hasOwn() over Object.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 on class-methods-use-this to false to allow for arrow function class methods.
    • Set the new onlyOneSimpleParam property on no-confusing-arrow to false. This explicitly chooses the current default behavior.
    • Set the new destructuredArrayIgnorePattern property on no-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 a useState call. (added in v7.29.0 of eslint-plugin-react)
    • react/iframe-missing-sandbox to follow security best practices and require a sandbox property on iframe elements. (added in v7.29.0 of eslint-plugin-react)
    • Utilize the new propElementValues property on react/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 on react/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 level off 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 level off 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 to error 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 the warn 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 bound let and const declarations so this may be a bit redundant, but it doesn't hurt.
  • Use a stricter configuration of the no-shadow rule by setting the builtinGlobals property to true. This disables shadowing of global variables (ex. Object and Array).

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.0
    • eslint-plugin-import: 2.24.2 -> 2.25.4
    • eslint-plugin-jest: 24.4.3 -> 26.1.1
    • eslint-plugin-jsx-a11y: 6.4.1 -> 6.5.1
    • eslint-plugin-react: 7.26.0 -> 7.29.3
    • eslint-plugin-react-hooks: 4.2.0 -> 4.3.0
    • jest: 27.2.3 -> 27.5.1

v1.5.0

26 Mar 23:31
16169a7
Compare
Choose a tag to compare

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 on react/jsx-no-useless-fragment to false to disallow all fragments.
  • Set the new allowLeadingUnderscore property on react/jsx-pascal-case to false to disallow component names staring with an underscore.
  • Set the new links and forms properties to true to prevent usage of unsafe target='_blank' inside links and forms.

Build:

  • Update all dependencies

v1.4.1

26 Mar 23:40
97f29a1
Compare
Choose a tag to compare

Changed:

  • Remove the allow: 'as-needed' property from the react/jsx-filename-extension rule as it was behaving in an unexpected fashion.
  • Update contact info in the package.json file.

v1.4.0

26 Mar 23:40
684ca5c
Compare
Choose a tag to compare

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 on react/jsx-filename-extension to as-needed to prevent the use of the .jsx file extension on files not using the JSX syntax.
  • Set the new checkKeyMustBeforeSpread property on react/jsx-key to true to enforce listing the JSX element key prior to spreading other props. This avoids a potential, unexpected createElement fallback.
  • Set the new warnOnSpreadAttributes property on react/jsx-no-target-blank to true. This ensures that the use of target="_blank" without rel="noreferrer" isn't missed even when spreading in props.
  • Switch the allowAllCaps property on react/jsx-pascal-case to true.
  • Add @axe-core/react, @testing-library/react, and prop-types as allowed modules in node/no-unpublished-import.
  • Add @next/bundle-analyzer and @wordpress/scripts as allowed modules in node/no-unpublished-require.
  • Disable the node/no-missing-import rule. It overlaps with the import/no-unresolved rule and can cause problems when module aliasing.

Build:

  • Update dependencies

v1.3.1

26 Mar 23:39
0d6bccc
Compare
Choose a tag to compare

Added:

  • A scripts configuration which extends the base config and is indented for CommonJS scripts

Changed:

  • Disabled the rule node/no-unsupported-features/es-syntax to allow for ES6 modules by default

Build:

  • Update dependencies

v1.3.0

26 Mar 23:39
227ab22
Compare
Choose a tag to compare

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 with id-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

26 Mar 23:38
cf09724
Compare
Choose a tag to compare

Added:

  • Tests to ensure that all configs are loaded properly

Changed:

  • Add option to react/jsx-curly-spacing to add padding to children within curly brackets

v1.2.1

26 Mar 23:38
4556f3f
Compare
Choose a tag to compare

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 to cypress which was undefined)

v1.2.0

26 Mar 23:37
5799d51
Compare
Choose a tag to compare

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 to arrow-function

Changed:

  • Set react-hooks/exhaustive-deps to warn as recommended
  • Set comma-dangle to always-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 than async() => {}
  • Amend indent rule to enforce indentation of two spaces on switch cases
  • Updates dependencies
  • Set default published NPM package access to public