This is a sharable eslint config for the @technologiestiftung organization. Should be the basis for JS and TS. Still WIP
The idea here is to start out with a flat config but still be backwards compatible with the old config. So our team does not have to set the env variable
After some testing it is not that easy to turn the config from flat file to commonjs. Since the old config will be deprecated soon with the release of eslint 9.0 this is actually to much effort. So we will just use the flat config and be done with it. \o/ESLINT_USE_FLAT_CONFIG=true
but can just reference this config as extend in the old config style if they need to.
The rules we apply should also be only for coding style not formatting. We should use prettier for that.
- [ ] Add more relevant rules
- [x] Figure out how we can use this for javascript and typescript projects
- [x] Add tests
- [ ]
Figure out how we can leverage the flat config already and be backwards compatible
- Node.js
- eslint
npm install @technologiestiftung/eslint-config --save-dev
In your eslint.config.js
file, add the following:
import technologiestiftung from "@technologiestiftung/eslint-config";
export default [
...technologiestiftung,
{
rules: {
// your rules here
},
},
];
ESLINT_USE_FLAT_CONFIG=true npx eslint
If you are using VSCode set the following in your settings:
{ "eslint.experimental.useFlatConfig": true }
Since we work on frontend and backend and this config is still WIP we provide some examples on how to use this config in different projects.
npm i globals eslint-plugin-react --save-dev
Then add this to your eslint.config.js
.
import globals from "globals";
import technologiestiftung from "@technologiestiftung/eslint-config";
import react from "eslint-plugin-react";
export default [
...technologiestiftung,
{
files: ["**/*.{js,jsx,mjs,cjs,ts,tsx}"],
languageOptions: {
parserOptions: {
ecmaFeatures: {
jsx: true,
},
},
globals: {
...globals.browser,
},
},
rules: {},
plugins: { react },
},
];
- Add good rules to
index.js
npm t
Before you create a pull request, write an issue so we can discuss your changes.
Thanks goes to these wonderful people (emoji key):
This project follows the all-contributors specification. Contributions of any kind welcome!
Made by
|
A project by
|
Supported by
|