1.7.0 • Published 2 years ago
@febase/eslint-config-ts v1.7.0
Eslint Config TS
This package provides eslint config for the Typescript projects.
Only support the new Eslint flat config.
Prettier and Linters
- Prettier Config:
Prettierconfig for theFront-endprojects. - Prettier Config:
Prettierconfig for theSvelteprojects. - Eslint Config Base:
Eslintconfig for theJavascriptprojects. - Eslint Config Typescript:
Eslintconfig for theTypescriptprojects. - Eslint Config React JS:
Eslintconfig for theReact JSprojects. - Eslint Config React TS:
Eslintconfig for theReact TSprojects. - Eslint Config Next JS:
Eslintconfig for theNext JSprojects. - Eslint Config Next TS:
Eslintconfig for theNext TSprojects. - Eslint Config Lit JS:
Eslintconfig for theLit JSprojects. - Eslint Config Lit TS:
Eslintconfig for theLit TSprojects. - Eslint Config Node ESM:
Eslintconfig for theNode Esmprojects. - Eslint Config Svelte JS:
Eslintconfig for theSvelteprojects. - Eslint Config Svelte TS:
Eslintconfig for theSvelte TSprojects.
and more to come.
Usage
1. Install package
pnpm add -D @febase/eslint-config-ts eslint2. Add config to your eslint.config.js. Please read more about Eslint Flat Config.
import { config } from '@febase/eslint-config-ts';
export default [...config];If you only want to use standalone ts config.
import { tsConfig } from '@febase/eslint-config-ts';
export default [tsConfig];3. Add script to your package.json.
{
"scripts": {
"lint": "eslint \"src/**/*.ts\"",
"lint:fix": "pnpm lint --fix"
}
}4. tsconfig.eslint.json and tsconfig.json.
- Search for the
tsconfig.eslint.jsonfile from the folder containing theeslint.config.jsfile up to the root folder. - if
tsconfig.eslint.jsonfile is not found. Thetsconfig.jsonfile in the current folder will be used. - If you have a
tsconfig.jsonfile and itsincludepaths include all the files you'd like to lint, you can directly use that file without using thetsconfig.eslint.jsonfile.
5. Monorepo
- Should only create a
tsconfig.eslint.jsonin root monorepo. parserOptions.projectsupports['./tsconfig.eslint.json', './packages/*/tsconfig.json', './apps/*/tsconfig.json'].
Configuration your VScode.
In root your project's folder. Create .vscode folder with structure:
.vscode
- settings.json{
"eslint.experimental.useFlatConfig": true,
// if the `eslint.config.js` file is in mono-repo please remove comment of the below line.
// "eslint.workingDirectories": [{ "pattern": "./apps/*/" }, { "pattern": "./packages/*/" }],
"eslint.options": {
"overrideConfigFile": "eslint.config.js"
},
"editor.codeActionsOnSave": {
"source.fixAll.eslint": true
},
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.formatOnSave": true
}Setup git hooks
- Install packages and global setup
husky,lint-staged.
pnpm add -D husky lint-staged
pnpm dlx husky install
pnpm pkg set scripts.prepare="husky install"
pnpm dlx husky add .husky/pre-commit "pnpm dlx lint-staged"- Add the following to your
package.json:
{
"lint-staged": {
"*.{js,jsx,ts,tsx}": ["pnpm format", "pnpm lint:fix"],
"*.{json,css,md,html}": ["pnpm format"]
}
}1.7.0
2 years ago
1.6.0
2 years ago
1.5.0
2 years ago
1.4.6
2 years ago
1.4.5
2 years ago
1.4.4
2 years ago
1.4.3
2 years ago
1.4.2
2 years ago
1.4.1
2 years ago
1.4.0
2 years ago
1.3.0
2 years ago
1.2.4
2 years ago
1.2.3
2 years ago
1.2.2
2 years ago
1.2.1
2 years ago
1.2.0
2 years ago
1.1.0
2 years ago
1.0.1
2 years ago
1.0.0
2 years ago