UNPKG

@amedia/eslint-config-jest

Version:

ESLint configuration to be used by developers at Amedia

283 lines (192 loc) 9.39 kB
# @amedia/eslint-config-jest ## 9.0.0 ### Major Changes - 326dc56: Migrate to ESLint 10.4.0. - Peer dependency on `eslint` widens from `9.x` to `10.x` across every `@amedia/eslint-config-*` package. - `@amedia/kragl-eslint` now bundles `eslint@10.4.0`. - `eslint-plugin-import` is replaced by `eslint-plugin-import-x` in `@amedia/eslint-config-base`. Consumers overriding `import/*` rules in their own config must rename the prefix to `import-x/*`. Rule semantics are unchanged. - `@amedia/eslint-config` now sets `linterOptions.reportUnusedDisableDirectives: 'error'` as part of the config it returns. The `--report-unused-disable-directives` CLI injection in `kragl-eslint` is removed (the behavior travels with the config now, so it also applies when running `eslint` directly). - React support is **temporarily unavailable**: `eslint-plugin-react` and `eslint-plugin-jsx-a11y` have not yet declared ESLint 10 peer support. `@amedia/eslint-config-react` is held at its previous major and excluded from this release. `eslintConfig({ react: true })` now throws a hard error pointing to the migration guide. React consumers must stay on `@amedia/eslint-config@4.x` until upstream catches up. - Plugin / library bumps that may surface new findings: - `eslint-plugin-unicorn` 56 → 64 - `eslint-plugin-svelte` 3.10 → 3.17 - `eslint-plugin-jest` 28 → 29 - `typescript-eslint` 8.39 → 8.59 - `globals` 13 → 16 See `docs/migrate-v5-v6.md` for the full migration guide. ### Minor Changes - 326dc56: Declare `engines.node: ">=22"` on every published package. Matches the constraint already set at the repository root. Consumers on older Node versions will see an `npm WARN` on install (or an error with `engine-strict=true`). ### Patch Changes - 7577d72: Rewrite all package READMEs to a consistent `# Title / tagline / Install / Use / Notes` shape. Drops stale `.eslintrc.js` / CJS examples, removes redundant "install plugin X yourself" instructions for plugins that are now bundled, and adds READMEs for the eight packages that previously had none (`biome-config`, `browserslist-config`, `jest-config`, `kragl-eslint`, `kragl-lockfile-lint`, `kragl-ls-lint`, `kragl-utils`). The `@amedia/eslint-config-react` README now documents its temporary freeze on the previous major. ## 8.0.1 ### Patch Changes - ba575f1: remove dead rule ## 8.0.0 ### Major Changes - d6346cc: Kragl 4.x _Get ready: This release breaks the world._ ESLint 9 introduces a new configuration format (flat config files)[^1] so as we move to ESLint 9 we need to re-do all the ESLint configuration both in this package, and in downstream repos. See the configuration docs for how to setup kragl for your project. [^1]: https://eslint.org/docs/latest/use/configure/configuration-files We are all-in on ECMAScript Modules at Amedia, but have been held back in this repo due to the tools we depend on have lagged behind. Now the world is ready, and we are making the move. Changes that hit the consumer are things like `.prettierrc.cjs` will not work with the `@amedia/prettier-config` package and the consumer needs to move to `prettier.config.js` with ESM syntax. `@amedia/eslint-config` exports an helper function that generates an ESLint configuration that complies with our standards, it supports both toggling options and full-on custom configuration. For example, a TypeScript + Svelte project: ``` import eslintConfig from '@amedia/eslint-config'; export default eslintConfig({ typescript: true, svelte: true, }); ``` We have had a long-standing issue of the LSP hanging when interacting with our Prettier configuration. This was likely due to our Prettier configuration dynamically loading the Svelte plugin if it was necessary. Some versions of Prettier struggle with that, so for kragl 4.x the consumer manually decides if the standard or svelte prettier configuration should be used. Standard: ``` // prettier.config.js export { default } from '@amedia/prettier-config'; ``` Svelte: ``` // prettier.config.js export { svelte as default } from '@amedia/prettier-config'; ``` ## 7.0.4 ### Patch Changes - dbb3437: add two new rules to eslint-base Adding rules may cause previously linted code to fail, though these two rules may be automatically fixed, so running `kragl lint --fix` should resolve the simple cases automatically. The reason for adding a requirement for the `node:` protocol prefix is to make it absolutely clear that this is an internal node module. This makes it easier for the reader to, as one example, immediately spot any node modules that may need polyfill for the browser. The second rules pushes us to use ESM everywhere it is expected by default. All CommonJS code needs to be moved to `.cjs` files, regardless if the module type is "module" or not. This also serves to help us move to a pure ESM based ecosystem for our internal codebase. ## 7.0.3 ### Patch Changes - fc7cb5d: Updates eslint 8.40.0 -> 8.56.0 ## 7.0.2 ### Patch Changes - a1cf31a: drop config exports from kragl-\* packages - a1cf31a: drop esoteric options for lint and format There are many options for lint and format, and most of them are never used. They were added for debugging purposes, and are superfluous after breaking out the runners to standalone kragl tools. This makes the lint and format commands a lot more straight-foward to use as intended, with fewer sharp edges. - a1cf31a: modularize kragl Introduce `kragl-eslint` and `kragl-prettier`, and expose an API so they can be used from `kragl`. The breaking change is that each runner's internal help text is now available under `--help`, e.g. `kragl prettier --help` or `kragl eslint --help`. They will print the help for Prettier and ESLint respectively, and replaces `--prettier-help`. Each command's usage matches the internal tool's, so `--eslint-config` is no longer necessary, just `--config` with suffice. `kragl lint` and `kragl format` serves as shortcuts to run all the configured formatters and runners with it's own options that normalize usage. - a1cf31a: drop config exports from kragl packages ## 7.0.2-next.3 ### Patch Changes - drop esoteric options for lint and format There are many options for lint and format, and most of them are never used. They were added for debugging purposes, and are superfluous after breaking out the runners to standalone kragl tools. This makes the lint and format commands a lot more straight-foward to use as intended, with fewer sharp edges. ## 7.0.2-next.2 ### Patch Changes - drop config exports from kragl packages ## 7.0.2-next.1 ### Patch Changes - b757c43: drop config exports from kragl-\* packages ## 7.0.2-next.0 ### Patch Changes - modularize kragl Introduce `kragl-eslint` and `kragl-prettier`, and expose an API so they can be used from `kragl`. The breaking change is that each runner's internal help text is now available under `--help`, e.g. `kragl prettier --help` or `kragl eslint --help`. They will print the help for Prettier and ESLint respectively, and replaces `--prettier-help`. Each command's usage matches the internal tool's, so `--eslint-config` is no longer necessary, just `--config` with suffice. `kragl lint` and `kragl format` serves as shortcuts to run all the configured formatters and runners with it's own options that normalize usage. ## 7.0.1 ### Patch Changes - c8b9f59: update eslint to 8.40.0 ## 7.0.0 ### Major Changes - b395434: Introduces the Kragl, a tool that makes it easy to use and comply with the Amedia code style and guidelines. Kragl provides commands like `lint` and `format`, which runs multiple tools with a single command, e.g. `lint` would run ESLint, Prettier, e.g. typechecks for TypeScript projects. Projects can use `kragl lint` with zero configuration and get the recommended rules by default (@amedia/prettier-config and @amedia/eslint-config) that attempts to identify the type of project (react/svelte/jest/typescript) and loads the relevant configuration. To get editor integration, projects should add at least two files: `.eslintrc.cjs`: module.exports = require('@amedia/kragl/config/eslint.config.cjs') `prettier.config.cjs`: module.exports = require('@amedia/kragl/config/prettier.config.cjs') To maximise effectiveness, the existing configurations have been changed to be more isolated in terms of scope (e.g. @amedia/eslint-config-react handles react rules only). This makes them easier to maintain, increases clarity about what rules go where, and generally makes them easier to reason about. This makes it a breaking change for consumers of those libraries. The pattern is to make it easier to do this: module.exports = { extends: [ '@amedia/eslint-config-base', '@amedia/eslint-config-react', '@amedia/eslint-config-jest', '@amedia/eslint-config-typescript', 'prettier', ], } And avoid problems where ESLint cannot uniquely reference a plugin or configuration as they should never collide due to duplication.