3.0.6 • Published 4 years ago
@flyyer/eslint-config v3.0.6
@flyyer/eslint-config
Please use this configuration to maintain a common and homogeneous code base.
Install
Install this package as any other package with:
yarn add --dev @flyyer/eslint-config eslint prettierCreate a .eslintignore and add any files that are bundled, builded and/or transpiled:
!.eslintrc.js
.vscode
.next
dist
public
node_modulesIn the package.json file add the following in the "scripts" section:
{
// ...
"scripts": {
// ...
"lint": "eslint '*/**/*.{js,ts,tsx}'",
},
}Configure for Javascript
Create a .eslintrc.js file in the root of your project and add the following:
// .eslintrc.js
module.exports = {
extends: [
"@flyyer/eslint-config",
"@flyyer/eslint-config/jest",
"@flyyer/eslint-config/prettier",
],
};Configure for Typescript
Create a .eslintrc.js file in the root of your project and add the following:
// .eslintrc.js
module.exports = {
extends: [
"@flyyer/eslint-config",
"@flyyer/eslint-config/typescript",
"@flyyer/eslint-config/jest",
"@flyyer/eslint-config/prettier",
],
};Configure for React + Typescript
Create a .eslintrc.js file in the root of your project and add the following:
// .eslintrc.js
module.exports = {
extends: [
"@flyyer/eslint-config",
"@flyyer/eslint-config/typescript",
"@flyyer/eslint-config/react",
"@flyyer/eslint-config/jest",
"@flyyer/eslint-config/prettier",
],
};Usage
To lint the files run:
yarn lintTo lint the files and auto-format run:
yarn lint --fixSetup Visual Studio Code
Create file .vscode/settings.json
mkdir -p .vscode
touch .vscode/settings.jsonAdd the following:
{
"editor.codeActionsOnSave": {
"source.fixAll.eslint": true
},
}Publishing
To make changes to this package run:
yarn link
yarn link '@flyyer/eslint-config'To publish and update of this package run:
# git add ...
# git commit ...
git push --follow-tags
yarn publish --access=publicUnlink this package:
yarn unlink '@flyyer/eslint-config'
yarn unlink