eslint.config.js
This file
Path
eslint.config.js
68 lines · 2.0 KiB · JavaScript
Last changed by
Update dependecies and lint (#2489)John Geebefore adoption0ea3bb3
History of this fileTake it
Switching to esm-only (#2464)John Geebefore adoptionf4bd470
lines 1–2why, one step back1import globals from 'globals';2import esLintjs from '@eslint/js';Update dependecies and lint (#2489)John Geebefore adoption0ea3bb3
line 3why, one step back3import { defineConfig } from 'eslint/config';Switching to esm-only (#2464)John Geebefore adoptionf4bd470
lines 4–5why, one step back4import tseslint from 'typescript-eslint';5import prettier from 'eslint-config-prettier';ESLint changes preparing for Prettier (#2153)John Geebefore adoption6fc933e
line 6why, one step back6Wrap all eslint configs in tseslint.config (#2182)John Geebefore adoptiona996782
line 7why, one step back7// Only run tseslint on the files that we have included for TypeScript.ESLint changes preparing for Prettier (#2153)John Geebefore adoption6fc933e
lines 8–9why, one step back8const tsconfigTsFiles = ['**/*.{ts,mts}']; // match "include" in tsconfig.ts.json;9const tsconfigJsFiles = ['*.{js,mjs}', 'lib/**/*.{js,mjs}']; // match "include" in tsconfig.js.jsonWrap all eslint configs in tseslint.config (#2182)John Geebefore adoptiona996782
lines 10–11why, one step back1011// Using tseslint.config adds some type safety and `extends` to simplify customising config array.Update dependecies and lint (#2489)John Geebefore adoption0ea3bb3
line 12why, one step back12export default defineConfig(Wrap all eslint configs in tseslint.config (#2182)John Geebefore adoptiona996782
lines 13–15why, one step back13 // Add recommended rules.14 esLintjs.configs.recommended,15 // tseslint with different setup for js/tsESLint changes preparing for Prettier (#2153)John Geebefore adoption6fc933e
lines 16–17why, one step back16 {17 files: tsconfigJsFiles,Update dependecies and lint (#2489)John Geebefore adoption0ea3bb3
line 18why, one step back18 extends: [tseslint.configs.recommended],ESLint changes preparing for Prettier (#2153)John Geebefore adoption6fc933e
lines 19–22why, one step back19 languageOptions: {20 parserOptions: { project: './tsconfig.js.json' },21 },22 rules: {Wrap all eslint configs in tseslint.config (#2182)John Geebefore adoptiona996782
line 23why, one step back23 '@typescript-eslint/no-var-requires': 'off', // tseslint does not autodetect commonjs contextMerge branch 'develop' into release/13.xJohn Geebefore adoption5a79585
line 24why, one step back24 '@typescript-eslint/no-require-imports': 'off', // tseslint does not autodetect commonjs contextESLint changes preparing for Prettier (#2153)John Geebefore adoption6fc933e
line 25why, one step back25 },Reformat code with Prettier (#2180)John Geebefore adoption1bdc749
lines 26–27why, one step back26 },27 {ESLint changes preparing for Prettier (#2153)John Geebefore adoption6fc933e
line 28why, one step back28 files: tsconfigTsFiles,Update dependecies and lint (#2489)John Geebefore adoption0ea3bb3
line 29why, one step back29 extends: [tseslint.configs.recommended],ESLint changes preparing for Prettier (#2153)John Geebefore adoption6fc933e
lines 30–51why, one step back30 languageOptions: {31 parserOptions: { project: './tsconfig.ts.json' },32 },33 },34 prettier, // Do Prettier last so it can override previous configs.3536 // Customise rules.37 {38 files: ['**/*.{js,mjs,cjs}', '**/*.{ts,mts,cts}'],39 rules: {40 'no-else-return': ['error', { allowElseIf: false }],41 },42 languageOptions: {43 globals: {44 ...globals.node,45 },46 },47 },48 {49 files: ['**/*.test.{js,mjs,cjs}'],50 rules: {51 'no-unused-vars': 'off', // lots in tests, minimise churn for nowReformat code with Prettier (#2180)John Geebefore adoption1bdc749
line 52why, one step back52 },ESLint changes preparing for Prettier (#2153)John Geebefore adoption6fc933e
lines 53–56why, one step back53 },54 {55 files: [...tsconfigTsFiles, ...tsconfigJsFiles],56 rules: {Reformat code with Prettier (#2180)John Geebefore adoption1bdc749
lines 57–65why, one step back57 '@typescript-eslint/ban-ts-comment': [58 'error',59 {60 'ts-expect-error': 'allow-with-description',61 'ts-ignore': 'allow-with-description',62 'ts-nocheck': true,63 'ts-check': true,64 },65 ],ESLint changes preparing for Prettier (#2153)John Geebefore adoption6fc933e
lines 66–67why, one step back66 },67 },Wrap all eslint configs in tseslint.config (#2182)John Geebefore adoptiona996782
line 68why, one step back68);