1.0.8 • Published 2 years ago
@anylint/eslint-config v1.0.8
STATUS: WIP
@anylint/eslint-config
@anylint/eslint-config is a versatile ESLint configuration package designed for JavaScript and TypeScript projects. It streamlines your development process by offering predefined ESLint rules and settings to maintain code quality and style consistency throughout your codebase.
Installation
Install the package:
$ npm install @anylint/eslint-config eslint --save-devJavaScript
Edit .eslintrc.json:
{
"root": true,
"overrides": [
{
"files": ["*.js"],
"extends": ["@anylint/eslint-config/javascript"],
"rules": {}
}
]
}TypeScript
Additionally, if you're using TypeScript, you need to install the typescript package:
$ npm install typescript --save-devEdit .eslintrc.json:
{
"root": true,
"overrides": [
{
"files": ["*.ts"],
"extends": ["@anylint/eslint-config/typescript"],
"rules": {}
}
]
}React
Edit .eslintrc.json:
- React for Web + JavaScript
{
"root": true,
"overrides": [
{
"files": ["*.js", "*.jsx"],
"extends": ["@anylint/eslint-config/javascript"],
"rules": {}
},
{
"files": ["*.jsx"],
"extends": ["@anylint/eslint-config/react-web"],
"rules": {}
},
,
]
}- React for Web + TypeScript
{
"root": true,
"overrides": [
{
"files": ["*.ts", "*.tsx"],
"extends": ["@anylint/eslint-config/typescript"],
"rules": {}
},
{
"files": ["*.jsx"],
"extends": ["@anylint/eslint-config/react-web"],
"rules": {}
}
]
}- React Native + JavaScript
{
"root": true,
"overrides": [
{
"files": ["*.js", "*.jsx"],
"extends": ["@anylint/eslint-config/javascript"],
"rules": {}
},
{
"files": ["*.jsx"],
"extends": ["@anylint/eslint-config/react-native"],
"rules": {}
}
]
}- React Native + TypeScript
{
"root": true,
"overrides": [
{
"files": ["*.ts", "*.tsx"],
"extends": ["@anylint/eslint-config/typescript"],
"rules": {}
},
{
"files": ["*.tsx"],
"extends": ["@anylint/eslint-config/react-native"],
"rules": {}
}
]
}Jest
Edit .eslintrc.json:
- Jest + JavaScript
{
"root": true,
"overrides": [
{
"files": ["*.test.js", "*.spec.js"],
"extends": ["@anylint/eslint-config/jest", "@anylint/eslint-config/tests"],
"rules": {}
}
]
}- Jest + TypeScript
{
"root": true,
"overrides": [
{
"files": ["*.test.ts", "*.spec.ts"],
"extends": ["@anylint/eslint-config/jest", "@anylint/eslint-config/tests"],
"rules": {}
}
]
}- Jest + React for Web + JavaScript
{
"root": true,
"overrides": [
{
"files": ["*.test.js", "*.spec.js"],
"extends": ["@anylint/eslint-config/jest", "@anylint/eslint-config/tests"],
"rules": {}
},
{
"files": ["*.test.jsx", "*.spec.jsx"],
"extends": [
"@anylint/eslint-config/react-web",
"@anylint/eslint-config/testing-library-react",
"@anylint/eslint-config/jest-web",
"@anylint/eslint-config/tests"
],
"rules": {}
}
]
}- Jest + React for Web + TypeScript
{
"root": true,
"overrides": [
{
"files": ["*.test.ts", "*.spec.ts"],
"extends": ["@anylint/eslint-config/jest", "@anylint/eslint-config/tests"],
"rules": {}
},
{
"files": ["*.test.tsx", "*.spec.tsx"],
"extends": [
"@anylint/eslint-config/react-web",
"@anylint/eslint-config/testing-library-react",
"@anylint/eslint-config/jest-web",
"@anylint/eslint-config/tests"
],
"rules": {}
}
]
}- Jest + React Native + JavaScript
{
"root": true,
"overrides": [
{
"files": ["*.test.js", "*.spec.js"],
"extends": ["@anylint/eslint-config/jest", "@anylint/eslint-config/tests"],
"rules": {}
},
{
"files": ["*.test.jsx", "*.spec.jsx"],
"extends": [
"@anylint/eslint-config/react-native",
"@anylint/eslint-config/testing-library-react",
"@anylint/eslint-config/jest-native",
"@anylint/eslint-config/tests"
],
"rules": {}
}
]
}- Jest + React Native + TypeScript
{
"root": true,
"overrides": [
{
"files": ["*.test.ts", "*.spec.ts"],
"extends": ["@anylint/eslint-config/jest", "@anylint/eslint-config/tests"],
"rules": {}
},
{
"files": ["*.test.tsx", "*.spec.tsx"],
"extends": [
"@anylint/eslint-config/react-native",
"@anylint/eslint-config/testing-library-react",
"@anylint/eslint-config/jest-native",
"@anylint/eslint-config/tests"
],
"rules": {}
}
]
}