Scratch ESLint Config
raw JSON → 14.1.13 verified Sat Apr 25 auth: no javascript
Shareable ESLint configuration for Scratch JavaScript and TypeScript projects, maintained by the Scratch Foundation. Current stable version is 14.1.13 (April 2026), with frequent releases (weekly bug fixes). It combines ESLint and Prettier for code style and correctness, providing flat config presets (recommended, recommendedTypeFree, recommendedTypeChecked) via eslintConfigScratch.defineConfig. Differentiators include first-class Scratch conventions, type-aware linting via typescript-eslint, and re-exported Prettier config (prettierConfigScratch). Requires ESLint 9 and Prettier 3 as peer dependencies.
Common errors
error Error [ERR_REQUIRE_ESM]: require() of ES Module from not supported. ↓
cause Using require() to import ESM-only package.
fix
Change to import syntax: import { eslintConfigScratch } from 'eslint-config-scratch'
error TypeError: eslintConfigScratch.defineConfig is not a function ↓
cause Using an older version that doesn't have defineConfig method, or wrong import.
fix
Update to v14 and import the named export correctly.
error Configuration for rule 'no-console' is invalid: Value 'off' is not accepted. ↓
cause Using severity as string instead of number in flat config.
fix
Use severity numbers (0, 1, 2) or string ('off', 'warn', 'error') but ensure proper format in the config array.
Warnings
breaking v14 moved to ESM-only flat config, removing support for .eslintrc.* files and CommonJS. ↓
fix Upgrade to eslint.config.mjs (or .js with type:module) and use eslintConfigScratch.defineConfig.
breaking Peer dependency eslint upgraded to ^9.0.0 in v14, incompatible with eslint <9. ↓
fix Update eslint to ^9 and prettier to ^3.
deprecated Legacy styles from eslint-config-scratch@^9 and below are no longer provided; only flat config presets are supported. ↓
fix If you need old rule sets, pin to v9 or migrate to new presets.
gotcha eslintConfigScratch.defineConfig is re-exported from '@eslint/config'; do not import separately. ↓
fix Use eslintConfigScratch.defineConfig(...) instead of importing defineConfig from a different package.
Install
npm install eslint-config-scratch yarn add eslint-config-scratch pnpm add eslint-config-scratch Imports
- eslintConfigScratch wrong
const eslintConfigScratch = require('eslint-config-scratch')correctimport { eslintConfigScratch } from 'eslint-config-scratch' - prettierConfigScratch wrong
import { prettierConfig } from 'eslint-config-scratch'correctimport { prettierConfigScratch } from 'eslint-config-scratch' - eslintConfigScratch.defineConfig wrong
import { defineConfig } from 'eslint-config-scratch'correctimport { eslintConfigScratch } from 'eslint-config-scratch' eslintConfigScratch.defineConfig(...)
Quickstart
// myProjectRoot/eslint.config.mjs
import { eslintConfigScratch } from 'eslint-config-scratch'
import { globalIgnores } from 'eslint/config'
export default eslintConfigScratch.defineConfig(
eslintConfigScratch.recommended,
{
files: ['src/**'],
languageOptions: {
parserOptions: {
projectService: true,
tsconfigRootDir: import.meta.dirname,
},
},
},
globalIgnores(['dist/**', 'node_modules/**']),
)
// myProjectRoot/prettier.config.mjs
import { prettierConfigScratch } from 'eslint-config-scratch'
export default prettierConfigScratch.recommended