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.