Common lint and formatting rules for OEV Berlin projects.
yarn add -D eslint eslint-plugin-oev
🚧 Note: This plugin only supports Eslint 9 and the flat configuration format.
Use oev/*
in your eslint.config.mjs
file:
import { nextConfig } from 'eslint-plugin-oev';
export default [
...nextConfig,
{
ignores: [
// ignore files you don't want to lint
],
}
];
-
import { nextConfig } from 'eslint-plugin-oev
: Use for Next.js projects -
import { reactConfig } from 'eslint-plugin-oev
: Use for React projects -
import { nodeConfig } from 'eslint-plugin-oev
: Use for Node projects
Check the overrides documentation for a list of rules we override and the rationale behind it.
In Version 1.0.0 we removed the prettier
dependency from this package. We replaced prettier with stylistic as we want to use one tool for formatting and linting.
In some IDEs, like VSCode, prettier is configured as the default formatter. To avoid conflicts, you need to disable prettier in your IDE. Take the following example settings.json
for VSCode:
"prettier.enable": false,
"editor.formatOnSave": false,
"editor.codeActionsOnSave": {
"source.fixAll.eslint": "explicit",
"source.organizeImports": "never"
},
"eslint.validate": [
"javascript",
"javascriptreact",
"typescript",
"typescriptreact",
"vue",
"html",
"markdown",
"json",
"jsonc",
"yaml",
"toml",
"xml",
"gql",
"graphql",
"astro",
"svelte",
"css",
"less",
"scss",
"pcss",
"postcss"
],
Execute the linting tests with:
yarn test
Note that linting errors are expected in the test files.
Another way of debugging the linting rules is to run the following command:
yarn inspect