Skip to content
Myr

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 file

Take it

Switching to esm-only (#2464)John Geebefore adoptionf4bd470

lines 1–2why, one step back
1import globals from 'globals';
2import esLintjs from '@eslint/js';

Update dependecies and lint (#2489)John Geebefore adoption0ea3bb3

line 3why, one step back
3import { defineConfig } from 'eslint/config';

Switching to esm-only (#2464)John Geebefore adoptionf4bd470

lines 4–5why, one step back
4import tseslint from 'typescript-eslint';
5import prettier from 'eslint-config-prettier';

ESLint changes preparing for Prettier (#2153)John Geebefore adoption6fc933e

line 6why, one step back
6

Wrap all eslint configs in tseslint.config (#2182)John Geebefore adoptiona996782

line 7why, one step back
7// 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 back
8const tsconfigTsFiles = ['**/*.{ts,mts}']; // match "include" in tsconfig.ts.json;
9const tsconfigJsFiles = ['*.{js,mjs}', 'lib/**/*.{js,mjs}']; // match "include" in tsconfig.js.json

Wrap all eslint configs in tseslint.config (#2182)John Geebefore adoptiona996782

lines 10–11why, one step back
10
11// 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 back
12export default defineConfig(

Wrap all eslint configs in tseslint.config (#2182)John Geebefore adoptiona996782

lines 13–15why, one step back
13 // Add recommended rules.
14 esLintjs.configs.recommended,15 // tseslint with different setup for js/ts

ESLint changes preparing for Prettier (#2153)John Geebefore adoption6fc933e

lines 16–17why, one step back
16 {
17 files: tsconfigJsFiles,

Update dependecies and lint (#2489)John Geebefore adoption0ea3bb3

line 18why, one step back
18 extends: [tseslint.configs.recommended],

ESLint changes preparing for Prettier (#2153)John Geebefore adoption6fc933e

lines 19–22why, one step back
19 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 back
23 '@typescript-eslint/no-var-requires': 'off', // tseslint does not autodetect commonjs context

Merge branch 'develop' into release/13.xJohn Geebefore adoption5a79585

line 24why, one step back
24 '@typescript-eslint/no-require-imports': 'off', // tseslint does not autodetect commonjs context

ESLint changes preparing for Prettier (#2153)John Geebefore adoption6fc933e

line 25why, one step back
25 },

Reformat code with Prettier (#2180)John Geebefore adoption1bdc749

lines 26–27why, one step back
26 },
27 {

ESLint changes preparing for Prettier (#2153)John Geebefore adoption6fc933e

line 28why, one step back
28 files: tsconfigTsFiles,

Update dependecies and lint (#2489)John Geebefore adoption0ea3bb3

line 29why, one step back
29 extends: [tseslint.configs.recommended],

ESLint changes preparing for Prettier (#2153)John Geebefore adoption6fc933e

lines 30–51why, one step back
30 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 now

Reformat code with Prettier (#2180)John Geebefore adoption1bdc749

line 52why, one step back
52 },

ESLint changes preparing for Prettier (#2153)John Geebefore adoption6fc933e

lines 53–56why, one step back
53 },
54 {55 files: [...tsconfigTsFiles, ...tsconfigJsFiles],56 rules: {

Reformat code with Prettier (#2180)John Geebefore adoption1bdc749

lines 57–65why, one step back
57 '@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 back
66 },
67 },

Wrap all eslint configs in tseslint.config (#2182)John Geebefore adoptiona996782

line 68why, one step back
68);