@libs-for-dev/eslint-rules
v2.0.0
Published
Libs for Dev ESLint rules
Downloads
246
Readme
Strict ESLint rules for libs-for-dev
repositories
This package provides the strictest ESLint rules for next type of files:
- javascript files
**/*.js
,**/*.cjs
,**/*.mjs
rules:- @eslint/js(Common JS rules)
- @eslint-community/eslint-plugin-eslint-comments
- @stylistic/eslint-plugin(No needed use
prettier
anymore) - eslint-plugin-check-file(Strict rules for files and folders naming)
- eslint-plugin-check-file
- eslint-plugin-jsdoc
- eslint-plugin-n
- eslint-plugin-perfectionist(Best sorting for everything in JS/TS)
- eslint-plugin-prefer-arrow(No needed use
function
anymore) - eslint-plugin-promise
- eslint-plugin-regexp
- eslint-plugin-unicorn(🦄)
- json
**/*.jsonc
,**/*.json
files(e.g. tsconfig.json, src/some-path/file.json) rules: eslint-plugin-jsonc - markdown
**/*.md
files rules: @eslint/markdown - ignores: common ignore rules for
**/dist/**
,**/node_modules/**
package.json
rules: eslint-plugin-package-json +json
rules- react
**/*.jsx
,**/*.tsx
files rules +javascript
:- eslint-plugin-jsx-a11y(Static AST checker for accessibility rules on JSX elements)
- eslint-plugin-react-hooks eslint-plugin-react-perf
- eslint-plugin-react
- svelte
**/*.svelte
files rules: eslint-plugin-svelte +javascript
rules - typescript
**/*.cts
,**/*.mts
,**/*.ts
files rules: typescript-eslint +javascript
rules - vitest
**/*.spec.cts
,**/*.spec.mts
,**/*.spec.ts
,**/*.test.cts
,**/*.test.mts
,**/*.test.ts
files rules: @vitest/eslint-plugin - vue
**/*.vue
files rules +javascript
rules:- eslint-plugin-vue-scoped-css
- eslint-plugin-vue
- eslint-plugin-vuejs-accessibility(An eslint plugin for checking accessibility rules from within
.vue
files)
Installation
yarn add @libs-for-dev/eslint-rules
Usage
Add to your eslint.config.mjs
config in project.
import { configs } from '@libs-for-dev/eslint-rules'
// Choose your project needs config
export default [
configs.ignores,
configs.json,
configs.markdown,
configs.packageJson,
configs.typescript,
configs.vitest,
configs.vue,
]
Customisation
import { configs } from '@libs-for-dev/eslint-rules'
export default [
configs.typescript,
configs.vue,
{
files: configs.vue.files,
languageOptions: configs.vue.languageOptions,
plugins: configs.vue.plugins,
rules: {
'vue/block-lang': ['error', { script: { lang: 'js' } }],
},
},
{
plugins: {
...configs.javascript.plugins,
},
rules: {
'check-file/filename-naming-convention': [
'error', { '**/*.vue': 'CAMEL_CASE' },
],
},
},
{
files: ['**/*.test.ts'],
rules: {
'max-lines-per-function': ['error', { max: 80 }],
},
},
{
files: ['/some/specific/folder/*.ts'],
rules: {
'max-lines': 'off',
},
}
]