yarn add -D @ver0/eslint-config
This configuration implies usage of typescript
and prettier
by default, even though it is possible to disable
respective lint rules -- these packages will be installed anyways.
import { buildConfig } from '@ver0/eslint-config';
/** @typedef {import('eslint').Linter} Linter */
/** @type {Linter.Config[]} */
const cfg = [
...buildConfig({
globals: 'node',
prettier: true,
typescript: true,
json: true,
markdown: true,
react: false,
vitest: false,
}),
{
files: ['README.md'],
language: 'markdown/gfm',
},
];
export default cfg;
Array returned from buildConfig
function is a list of ESLint configurations that should be spreaded into the final
configuration.
Globals configuration also controls some configs and plugins.
In case globals is set to node
- it enables node
plugin and node
environment.
In order to sync configuration of prettier with ESLint, it is recommended to extend the configuration from this package.
import ver0Cfg from '@ver0/eslint-config/.prettierrc.js';
/**
* @type {import("prettier").Config}
*/
export default {
...ver0Cfg,
};
.editorconfig
with according configuration can also be copied from this repo.
[*]
indent_style = tab
tab_width = 2
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
max_line_length = 120
[*.yml]
indent_style = space
indent_size = 2