QuickCasa Form OSS-1Open source tools

Fee payable$0.00

All projectsSchedule 6 to Form OSS-1

ESLint config

The ESLint rules QuickCasa holds its own JavaScript and TypeScript to.

1aType

npm package

1bLicence

MIT

1cCost

$0.00

1dAccount required

No

1eInstall
npm install --save-dev eslint typescript@~6.0.3 @quickcasa/eslint-config

What it enforces

  • No any type, and no unknown type.
  • Full words in names, such as button rather than btn. props and params are fine.
  • One export statement per file, at the end.
  • Comments on their own line, never beside code.
  • Braces on every if, else and loop, and no nested ternaries.
  • The u or v flag on every regular expression.
  • No variables named after browser globals such as event or document.
  • No file longer than 800 lines, no console.log and 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 scripts or bin folder can log to the console and call process.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.

Know a simple job that deserves a free tool?

Tell us what you'd like to see next, or ask about any of these projects.

Get in touch