All projectsSchedule 6 to Form OSS-1
ESLint config
The ESLint rules QuickCasa holds its own JavaScript and TypeScript to.
npm package
MIT
$0.00
No
npm install --save-dev eslint typescript@~6.0.3 @quickcasa/eslint-config
What it enforces
- No
anytype, and nounknowntype. - Full words in names, such as
buttonrather thanbtn.propsandparamsare fine. - One export statement per file, at the end.
- Comments on their own line, never beside code.
- Braces on every
if,elseand loop, and no nested ternaries. - The
uorvflag on every regular expression. - No variables named after browser globals such as
eventordocument. - No file longer than 800 lines, no
console.logand no circular imports. - A JSDoc block, when there is one, types every parameter and the return value.
On top of those, it turns on ESLint's recommended rules, typescript-eslint's recommended rules and most of eslint-plugin-unicorn's recommended rules.
Set it up
You need Node.js 22 or later, ESLint 10.4 or later and TypeScript 4.8.4 to 6.0. Install it, then create eslint.config.js in the root of your project:
import { defineConfig } from 'eslint/config'
import quickcasa from '@quickcasa/eslint-config'
export default defineConfig([{ ignores: ['dist'] }, ...quickcasa])Run npx eslint . to check your code. Most problems can be fixed with npx eslint . --fix. To change a rule, add your own config object after the spread.
Built-in exceptions
- Type and style files can use several export statements, because they exist to hold many small declarations.
- Test files can nest callbacks as deeply as they need.
- Scripts in a
scriptsorbinfolder can log to the console and callprocess.exit().
Questions
Does it work with TypeScript 7?
Not directly yet. typescript-eslint reads TypeScript through its JavaScript API, and TypeScript 7 doesn't ship that API yet. The README shows how to alias TypeScript 6 for ESLint while you type check with TypeScript 7.
Does it need type information?
No. It doesn't use type information, so it needs no tsconfig setup and runs quickly. You can add typescript-eslint's type-aware rules after the spread.
Does it format code?
No. It leaves formatting to Prettier.