Repository navigation
recover strict 2024 eslint config at repo root #87
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,38 @@ | ||
| // @ts-check | ||
| // | ||
| // Ported from the 2024 cli/bot eslint.config.mjs (recovered from git | ||
| // history at 00ff6e3) to the repository root. Preset stack preserved: | ||
| // eslint recommended + typescript-eslint strictTypeChecked + | ||
| // stylisticTypeChecked, with the same two rule relaxations. | ||
|
|
||
| import eslint from "@eslint/js" | ||
| import tseslint from "typescript-eslint" | ||
|
|
||
| export default tseslint.config( | ||
| eslint.configs.recommended, | ||
| ...tseslint.configs.strictTypeChecked, | ||
| ...tseslint.configs.stylisticTypeChecked, | ||
| { | ||
| ignores: [ | ||
| "dist/", | ||
| "test/", | ||
| "packages/", | ||
| "tooling/", | ||
| "**/*.test.ts", | ||
| "**/*.test.mjs", | ||
| "eslint.config.mjs", | ||
| ], | ||
| }, | ||
| { | ||
| files: ["pi/**/*.ts"], | ||
| rules: { | ||
| "@typescript-eslint/no-non-null-assertion": "off", | ||
| "@typescript-eslint/restrict-template-expressions": "off", | ||
| }, | ||
| languageOptions: { | ||
| parserOptions: { | ||
| project: ["pi/extensions/tsconfig.json"], | ||
| }, | ||
| }, | ||
| }, | ||
| ) | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| import assert from "node:assert/strict" | ||
| import { readFileSync } from "node:fs" | ||
| import test from "node:test" | ||
|
|
||
| const source = readFileSync(new URL("../eslint.config.mjs", import.meta.url), "utf8") | ||
|
|
||
| test("root eslint config preserves the strict 2024 preset stack", () => { | ||
| assert.match(source, /eslint\.configs\.recommended/) | ||
| assert.match(source, /strictTypeChecked/) | ||
| assert.match(source, /stylisticTypeChecked/) | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win 🔎 Supported by static analysis🏁 Script executed: sed -n '1,90p' pi/test-strict-eslint-config.test.mjs
sed -n '1,110p' eslint.config.mjsRepository: dataclique/metagenda Length of output: 2030 🏁 Script executed: set -eu
printf '%s\n' '--- package metadata ---'
sed -n '1,180p' package.json
printf '%s\n' '--- relevant tracked files ---'
git ls-files | rg '(^|/)(package(-lock)?\.json|pnpm-lock\.yaml|yarn\.lock|eslint|test-strict-eslint-config)'
printf '%s\n' '--- nearby config-test references ---'
rg -n -C 3 'test-strict-eslint-config|calculateConfigForFile|FlatESLint|loadESLint|eslint\.config' pi test packages tooling 2>/dev/null || true
printf '%s\n' '--- changed-file diff summary against supplied base ---'
git diff --stat 8e0d10d73b034fd2f1b6a00647c6674545a415d7 c501074f07c2c20e125bedb6afd8ddbcfb6103db -- pi/test-strict-eslint-config.test.mjs eslint.config.mjs package.jsonRepository: dataclique/metagenda Length of output: 3555 🤖 get_repo_knowledge executed:
Length of output: 10921 Test the effective ESLint configuration instead of source text. These assertions only inspect text. They can pass when source fragments occur in comments or when the exported configuration does not apply them to the intended files. Load the exported configuration and inspect the effective rules for a 🤖 Prompt for AI Agents |
||
| }) | ||
|
|
||
| test("both original rule relaxations are preserved", () => { | ||
| assert.match(source, /"@typescript-eslint\/no-non-null-assertion": "off"/) | ||
| assert.match(source, /"@typescript-eslint\/restrict-template-expressions": "off"/) | ||
| }) | ||
|
|
||
| test("parser project points at the extension tsconfig", () => { | ||
| assert.match(source, /project: \["pi\/extensions\/tsconfig\.json"\]/) | ||
| }) | ||
|
|
||
| test("type-checked linting is scoped to the pi tree", () => { | ||
| assert.match(source, /files: \["pi\/\*\*\/\*\.ts"\]/) | ||
| }) | ||
Uh oh!
There was an error while loading. Please reload this page.