This package provides the ESLint configuration with custom rules for enforcing coding standards within Commencis projects. With predefined rules and configurations, it ensures consistent code quality and style across codebases.
To use this ESLint configuration in your project, simply install it as a dev dependency:
With npm
:
npm install --save-dev eslint @commencis/eslint-config
With yarn
:
yarn add --dev eslint @commencis/eslint-config
With pnpm
:
pnpm add --save-dev eslint @commencis/eslint-config
Important
All the configs provided by this package is for the new ESLint Flat config that supported with ESLint >= v9
This package provides defineConfig
function and includes config sets and can be found in package exports as following,
- Commencis Base:
commencisBaseConfig
- Typescript:
commencisTypescriptConfig
- React:
commencisReactConfig
- NextJs:
commencisNextConfig
- Vue:
commencisVueConfig
- Prettier:
commencisPrettierConfig
Firstly create your eslint.config.js
and use the desired config by your project.
// eslint.config.js
import { commencisReactConfig, defineConfig } from '@commencis/eslint-config';
export default defineConfig(...commencisReactConfig, {
/* ... */
});
// eslint.config.js
import {
commencisReactNativeConfig,
defineConfig,
} from '@commencis/eslint-config';
export default defineConfig(...commencisReactNativeConfig, {
/* ... */
});
// eslint.config.js
import { commencisNextConfig, defineConfig } from '@commencis/eslint-config';
export default defineConfig(...commencisNextConfig, {
ignores: ['.next/', 'next.config.js', 'next-env.d.ts'],
});
// eslint.config.js
import { commencisVueConfig, defineConfig } from '@commencis/eslint-config';
export default defineConfig(...commencisVueConfig);
React, NextJs, Vue
configs include base, typescript, prettier
configs as bundle. You dont have to add them seperately. But also override any rules by your needs.
You can also import the configs seperately and merge them if needed on specific cases.
// eslint.config.js
import baseConfig from '@commencis/eslint-config/base';
import typescriptConfig from '@commencis/eslint-config/typescript';
export default [...baseConfig, ...typescriptConfig];
We welcome contributions to improve this package. Feel free to open issues or pull requests to suggest enhancements or report any issues.
This project is licensed under the Apache License 2.0 - see the LICENSE file for details.
© Commencis, 2024. All rights reserved.