@mediamonks/eslint-config
Version:
Sharable eslint config based on Media.Monks Frontend Coding Standards
95 lines (75 loc) • 2.77 kB
Markdown
is a set of linting rules and presets designed to enforce the
[ ](https://github.com/mediamonks/frontend-coding-standards) at Monks. This
configuration helps maintain code quality and consistency across different projects by providing
tailored presets for various project types, including JavaScript, TypeScript, and React.
1. Install `@mediamonks/eslint-config`
```sh
npm install --save-dev @mediamonks/eslint-config
```
2. Create a `eslint.config.js` file in the root of your module
3. Configure your project with one of the configuration presets
| Project Type | Preset Name | Description |
| -------------------- | --------------- | -------------------------------------------- |
| JavaScript | javascript | Preset for standard JavaScript projects |
| JavaScript and React | react | Preset for React projects using JavaScript |
| TypeScript | typescript | Preset for TypeScript projects |
| TypeScript and React | typescriptReact | Preset for React projects using TypeScript |
| JavaScript (Node.js) | javascriptNode | Preset for Node.js projects using JavaScript |
| TypeScript (Node.js) | typescriptNode | Preset for Node.js projects using TypeScript |
The package provides presets tailored for different project types. These presets ensure that your
project adheres to the coding standards and best practices. Below are examples of how to configure
your project using these presets.
```js
import { configs } from '@mediamonks/eslint-config';
export default [
...configs.javascript,
{
ignores: ['build/*'],
},
{
languageOptions: {
// Your project language options...
// Please see the eslint documentation for more details
},
},
];
```
```js
import { configs } from '@mediamonks/eslint-config';
import tseslint from 'typescript-eslint';
export default tseslint.config(
...configs.typescript,
{
ignores: ['build/*'],
},
{
languageOptions: {
// Your project language options...
// Please see the eslint/typescript-eslint documentation for more details
},
},
);
```
```js
import { configs } from '@mediamonks/eslint-config';
import tseslint from 'typescript-eslint';
export default tseslint.config(
...configs.typescriptReact,
{
ignores: ['build/*'],
},
{
languageOptions: {
// Your project language options...
// Please see the eslint/typescript-eslint documentation for more details
},
},
);
```
The Monks ESLint Configuration