@buildinams/lint
v1.0.1
Published
BiA's base lint config(s).
Readme
lint
BiA's base lint config(s).
Requirements
- Node >=20.19.0 | ESLint >=9.0.0
- TypeScript >=5.1.0, React >=17.0.0, Prettier >=3.0.0, Stylelint >=16.0.0 — as needed
Uses ESLint flat config. Legacy .eslintrc.* is not supported.
Installation
npm i -D @buildinams/lint eslint prettier stylelintDrop prettier and/or stylelint if you don't need them.
ESLint
| Config | Export path |
|---|---|
| JavaScript | @buildinams/lint/eslint/javascript |
| TypeScript | @buildinams/lint/eslint/typescript |
| React | @buildinams/lint/eslint/react |
| React + TypeScript | @buildinams/lint/eslint/react-typescript |
| Next.js | @buildinams/lint/eslint/next |
| Next.js + TypeScript | @buildinams/lint/eslint/next-typescript |
// eslint.config.mjs
import config from "@buildinams/lint/eslint/next-typescript";
import { globalIgnores } from "eslint/config";
export default [
...config,
globalIgnores([".next/**", "out/**", "build/**"]),
];// eslint.config.js
module.exports = [...require("@buildinams/lint/eslint/next-typescript")];Bundled plugins
unused-imports, simple-import-sort, import-x, prettier (formatting errors as lint errors), react + react-hooks + jsx-a11y (React/Next), @next/eslint-plugin-next (Next), typescript-eslint (TS).
Custom rules
- Import order: externals → absolute (
_,~prefixed) → relative typeoverinterfaceviaconsistent-type-definitions- No enums — use
as constinstead (only non-auto-fixable rule) - No
console.log—warnanderrorallowed - React version defaults to
19. Override for older versions:
// eslint.config.mjs
export default [
...config,
{ settings: { react: { version: "18" } } },
];Prettier
// .prettierrc.mjs
export { default } from "@buildinams/lint/prettier";Trailing commas "all" | Tabs | Double quotes
Formatting errors also surface as ESLint errors via eslint-plugin-prettier.
Stylelint
// .stylelintrc.json
{
"extends": "@buildinams/lint/stylelint"
}Extends: standard-scss, css-modules, recess-order, stylelint-prettier. Enables scss/selector-no-redundant-nesting-selector.
{
"extends": "@buildinams/lint/stylelint",
"rules": {
"scss/function-no-unknown": [true, { "ignoreFunctions": ["px-to-rem"] }]
}
}VSCode
Extensions: vscode-eslint, prettier-vscode, vscode-stylelint
// .vscode/settings.json
{
"editor.formatOnSave": false,
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.codeActionsOnSave": {
"source.fixAll.eslint": "explicit",
"source.fixAll.stylelint": "explicit"
},
"scss.validate": false,
"stylelint.validate": ["scss"]
}Migrating from v0.4.x
- Update to ESLint 9+ and Node 20+
- Delete
.eslintrc.* - Create
eslint.config.mjs(see above)
Pin @buildinams/[email protected] if staying on ESLint 8.
Contributing
Found an issue? Want a new feature? Get involved.
