import/extensions
: see #987
@typescript-eslint/explicit-function-return-type
- rule updated to not require an explicit return type annotation on anonymous functions
- NOTE: technically, we accidentally removed this rule in v11 and this is restoring it with relaxed options
- Disabled
no-await-in-loop
rule in recommended config. - Disabled many lodash rules:
lodash/chaining
lodash/identity-shorthand
lodash/prefer-compact
lodash/prefer-wrapper-method
lodash/prefer-get
lodash/prefer-is-nil
lodash/prefer-lodash-chain
lodash/prefer-startswith
eslint-plugin-goodeggs/prettier-config
is no longer available! Please, use@goodeggs/toolkit/config/prettier
instead.- Upgrade to eslint v8.
- The most notable change is the addition of these four rules to the recommended set:
no-loss-of-precision
no-nonoctal-decimal-escape
no-unsafe-optional-chaining
no-useless-backreference
- The most notable change is the addition of these four rules to the recommended set:
- Upgrade from deprecated
babel-eslint
to@babel/eslint-parser
.- See https://github.com/babel/babel-eslint#note-babel-eslint-is-now-babeleslint-parser-and-has-moved-into-the-babel-monorepo.
- This should be pretty seamless.
- Upgrade to eslint-plugin-jest@25.
- A few rules were renamed. This would only be breaking if your codebase had an eslint override for one of these.
- Upgrade to eslint-config-prettier@8.
- This would only be breaking if your eslint config had some pretter config overrides for some reason.
- Upgrade various other peer dependencies. This will only be breaking in @goodeggs/toolkit itself and seamless elsewhere.
- import/no-anonymous-default-export
- See #438.
- unicorn/filename-case
eol-last
(error, always)- See https://github.com/goodeggs/standards-and-best-practices/issues/302 for a detailed discussion about
eol-last
recommended config.
- See https://github.com/goodeggs/standards-and-best-practices/issues/302 for a detailed discussion about
- @typescript-eslint/array-type
- @typescript-eslint/prefer-includes
- @typescript-eslint/prefer-for-of
- @typescript-eslint/no-unnecessary-boolean-literal-compare
- @typescript-eslint/no-confusing-void-expression
- @typescript-eslint/prefer-optional-chain
- @typescript-eslint/consistent-type-definitions
- See #610 for all the above.
@typescript-eslint/naming-convention
- Forbids the
I
prefix for interface type names. - See #827.
- Forbids the
@typescript-eslint/strict-boolean-expressions
(Enhanced).- Enhanced rule based on the proposal discused by the team.
no-constructor-return
- We decided not to make this a major even though this technically breaking. We expect this to introduce no errors in almost every codebase.
See #597 for a detailed changelog.
- Restored naming convention rules for TypeScript files, unintentionally removed (regressed) in v11.
- This closely resembles the configuration in v10.
- There are a few small conveniences added that relax some previous rules.
- There are also a few small additions that make this config a bit stricter than previously.
- The most notable of these is requiring enum members to be in
PascalCase
.
- The most notable of these is requiring enum members to be in
- Fixed various TypeScript rules by actually disabling the superseded base eslint rules. See
https://github.com/typescript-eslint/typescript-eslint/blob/885780d4a2b07e418256b7323d76b18453c14a50/packages/eslint-plugin/README.md#extension-rules.
- When upgrading to this version, you should clean up redundant overrides that disable the following rules:
camelcase
no-array-constructor
no-empty-function
no-extra-semi
no-implied-eval
no-shadow
no-throw-literal
no-unused-vars
no-use-before-define
no-useless-constructor
- When upgrading to this version, you should clean up redundant overrides that disable the following rules:
Unfortunately, mongoose's Model
(both in @types/mongoose
and in the new built-in type
declarations) is not typed as a class
even though it is one. This means that TypeScript doesn't
think it's a class, so @typescript/eslint
doesn't think it's a class, so it doesn't allow
PascalCase. It's unclear what next steps here are. Perhaps open a @types/mongoose issue or PR? In
the meantime, this must be eslint-disable
d or otherwise worked around (e.g. export the model
without naming it).
- Upgrade @typescript-eslint to v4.6.1.
- Make TypeScript >=4.0.5 an optional peer dependency.
- Upgrade to ESLint 7: https://eslint.org/docs/user-guide/migrating-to-7.0.0
- Drop support for node 8
@typescript-eslint/naming-convention (error)
- Enforces PascalCase for class, interface, typeAlias, enum, and typeParameter, camelCase for everything else.
@typescript-eslint/ban-ts-comment
.- `@ts-ignore is now allowed as long as there is a comment explaining why it was used.
@typescript-eslint/strict-boolean-expressions
(error).- Forbids usage of non-boolean types in expressions where a boolean is expected, including strings, numbers, and nullable objects.
@typescript-eslint/ban-types
.- Rule settings have not changed, but the updated version of the rule is more restrictive -
{}
andFunction
types are now disallowed.
- Rule settings have not changed, but the updated version of the rule is more restrictive -
no-dupe-else-if
(error)no-import-assign
(error)no-setter-return
(error)
As part of the ESLint 7 upgrade, a few rules have been updated to cover more cases.
- Upgrade to Prettier 2.0. To upgrade, simultaneously upgrade eslint-plugin-goodeggs to v10 and prettier to v2, then run
eslint --fix
(or equivalent command) to reformat given the updated rules.
- Disable
react/no-adjacent-inline-elements
(warn), which sometimes errors out. I'll look into re-enabling this later.
@typescript-eslint/ban-ts-ignore
(error): Replaced by the newer, stricterban-ts-comment
rule. If your code overrides this rule, something likeag -Q '@typescript-eslint/ban-ts-ignore' -l --print0 | xargs -0 sed -i '' 's|@typescript-eslint/ban-ts-ignore|@typescript-eslint/ban-ts-comment|g'
should fix most instances of it.
react/jsx-no-script-url
(error)react/no-adjacent-inline-elements
(warn)prefer-object-spread
: (warn) - Warn for now to give consumers time to update their code.no-unused-vars
: enablecaughtErrors: 'all'
(error) - Enforce use of the error parameter incatch
blocks@typescript-eslint/ban-ts-comment
(error)@typescript-eslint/default-param-last
(warn)@typescript-eslint/no-extra-semi
(error)@typescript-eslint/no-implied-eval
(error)@typescript-eslint/no-throw-literal
(error)@typescript-eslint/prefer-as-const
(error)@typescript-eslint/no-unnecessary-boolean-literal-compare
(error)
- TypeScript: Replace
no-return-await
with@typescript/eslint/return-await
- TypeScript: Prohibit unnecessary non-null assertions (e.g.
foo!!.bar
) - TypeScript: Prohibit plus operators (
+
and+=
) on different types (e.g. prhibit adding a string to a number)
This is a significant update with several breaking changes.
- No longer bundle third-party eslint plugins in this package; instead, they are now peers, and it's the responsibility of the consumer to install them.
- Revert all namespaced rules to their stock values (e.g.
goodeggs/import-whatever
->import/whatever
) - Rename base shared configuration from
goodeggs
torecommended
(plugin:goodeggs/goodeggs
->plugin:goodeggs/recommended
) - Break flowtype configuration into
flowtype
shared config (plugin:goodeggs/flowtype
) - Break mocha configuration into
mocha
shared config (plugin:goodeggs/mocha
) - Break TypeScript configuration into
typescript
shared config (plugin:goodeggs/typescript
) - Break jest configuration into
jest
andjestStrict
configurations (plugin:goodeggs/jest
andplugin:goodeggs/jestStrict
) - Remove all stylistic rules (covered by
eslint-config-prettier
) - Add React plugin and enable sane default rules that reflect current best practices and introduce some new ones that prevent common React performance errors.
- Disable new-cap rules for
unionized.JSONSchemaFactory
(previously we only permittedJSONSchemaFactory
) - Ops-specific rules:
- Move ops-specific configuration into its own config (
plugin:goodeggs/ops
) - Disable new-cap rules
dryrain(Api).DT_*
invocations
- Move ops-specific configuration into its own config (
- We no longer configure the linter to find modules in locations other than
node_modules
(e.g.local_modules
in ops repos, andsrc
in Garbanzo). See the migration guide below for instructions on how to configure it.
In addition to these changes, many rules have been fixed, problematic rules disabled, and new rules enabled.
Uninstall eslint
, babel-eslint
, prettier
, eslint-plugin-goodeggs
, and any other ESLint plugins that are listed in the peer dependencies for this package.
Next, install @goodeggs/toolkit
and replace any eslint
scripts with getk run lint-es <glob>
and getk run fix-es <glob>
.
Finally, change the contents of .prettierrc.js
to:
module.exports = require('@goodeggs/toolkit/config/prettier');
Edit your ESLint configuration and any inline overrides (run grep -R "eslint-disable.*goodeggs\/" .
to find them).
Remove prefixes like so: goodeggs/import-no-commonjs
becomes import/no-commonjs
.
Here's a baseline configuration that makes no assumptions about your environment or test framework, etc.:
{
"extends": ["plugin:goodeggs/recommended"]
}
You will likely want to extend this with more rules (e.g. React rules); you can find a full list of configurations here.
We no longer automatically configure eslint-plugin-goodeggs
with custom module directories. Module aliases are configured via Webpack, Babel, and other similar tools and specifying them in this repository has led to a tragedy-of-the-commons configuration that assumes implementation details and doesn't work particularly well for consumers.
If you use babel-plugin-module-resolver
to create custom imports (e.g. in Garbanzo, imports like nettle/*
), you must configure eslint-import-resolver-babel-module
in your project.
Consumers that depend on the local_modules
pattern provided by babel-plugin-local-modules
should update their ESLint configuration to include the following configuration:
settings: {
'import/resolver': {
node: {
moduleDirectory: [
// Default
'node_modules',
// Adds anything in the root directory (including local_modules) to the module lookup path
'.',
],
},
},
},
For more information, see this commit.
This release fixes a slew of broken lint rules and introduces new rules that target problematic code, and so you may need to fix new errors you haven't seen before. We tried to enable rules that were autofixable, but you'll need to manually fix those that are not.
- Add
DT_DecoderDataResponse
(part of the DryRain API) tonewCap
exceptions
- Disable
prefer-reflect
. This rule is deprecated and we already disable it all over the place.