Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@
"dependencies": {
"eslint-config-prettier": "^10.1.8",
"eslint-import-resolver-typescript": "^4.4.5",
"eslint-plugin-import-x": "^4.17.1",
"eslint-plugin-import-x": "^4.18.1",
"globals": "^17.13.0",
"jsonc-parser": "^3.3.1",
"yaml": "^2.9.1"
Expand Down
70 changes: 46 additions & 24 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions pnpm-workspace.yaml
Original file line number Diff line number Diff line change
@@ -1,2 +1,8 @@
allowBuilds:
unrs-resolver: false
overrides:
# GHSA-g3hv-75wg-m249 (minimatch < 11.0.1): eslint and typescript-eslint still ask for ^10, which has no fix.
# Drop this once they allow 11.
'minimatch@<11.0.1': ^11.0.1
# GHSA-mrhx-c7xc-m3w5 (zod < 4.6.6), through knip and @angular/forms; their ranges allow the fix
'zod@<4.6.6': ^4.6.6
6 changes: 3 additions & 3 deletions scripts/rules-add.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import path from 'node:path';
import process from 'node:process';
import { fileURLToPath } from 'node:url';

import * as prettier from 'prettier';
import { format, resolveConfig } from 'prettier';

import { gaps, inventories } from './rule-inventory.mjs';

Expand Down Expand Up @@ -70,8 +70,8 @@ async function main() {
remove,
add: undecided.map((rule) => [rule, inventory.initial(rule)]),
});
const options = await prettier.resolveConfig(file);
writeFileSync(file, await prettier.format(updated, { ...options, filepath: file }));
const options = await resolveConfig(file);
writeFileSync(file, await format(updated, { ...options, filepath: file }));
changed += undecided.length + remove.length;
for (const rule of undecided) {
console.log(`${inventory.file}: added ${rule}: ${JSON.stringify(inventory.initial(rule))}`);
Expand Down
2 changes: 0 additions & 2 deletions src/eslint/index.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@ import { typescript } from './layers/typescript.mjs';
import { vitest } from './layers/vitest.mjs';
import { normalizeOptions, OPTIONS_SETTING } from './options.mjs';

export { angular, ignores, imports, javascript, normalizeOptions, prettier, typescript, vitest };

/** @typedef {import('./options.mjs').Options} Options */
/** @typedef {import('eslint').Linter.Config} Config */

Expand Down
4 changes: 3 additions & 1 deletion src/eslint/rules/angular-template.mjs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* @angular-eslint/template rules. Every plugin rule is listed; effective configuration.
*/
export default /** @type {import('eslint').Linter.RulesRecord} */ ({
const rules = /** @type {import('eslint').Linter.RulesRecord} */ ({
'@angular-eslint/template/alt-text': 'error',
'@angular-eslint/template/attributes-order': 'error',
'@angular-eslint/template/banana-in-box': 'error',
Expand Down Expand Up @@ -56,3 +56,5 @@ export default /** @type {import('eslint').Linter.RulesRecord} */ ({
'@angular-eslint/template/require-switch-default': 'error',
'@angular-eslint/template/prefer-style-binding': 'error',
});

export default rules;
4 changes: 3 additions & 1 deletion src/eslint/rules/angular.mjs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* @angular-eslint rules for TypeScript. Every plugin rule is listed; effective configuration.
*/
export default /** @type {import('eslint').Linter.RulesRecord} */ ({
const rules = /** @type {import('eslint').Linter.RulesRecord} */ ({
// prefix comes from createConfig({ angular: { prefix } }); the angular layer sets the options
'@angular-eslint/directive-selector': 'error',
'@angular-eslint/component-selector': 'error',
Expand Down Expand Up @@ -62,3 +62,5 @@ export default /** @type {import('eslint').Linter.RulesRecord} */ ({
// previously crashed on Signal Forms destructuring; verified fixed by test/lint.test.mjs
'@angular-eslint/reactive-context-must-read-signal': 'error',
});

export default rules;
12 changes: 11 additions & 1 deletion src/eslint/rules/imports.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* Resolution-based rules are off except no-cycle: TypeScript already reports unresolved modules
* and missing named exports. The imports layer configures the TypeScript resolver for no-cycle.
*/
export default /** @type {import('eslint').Linter.RulesRecord} */ ({
const rules = /** @type {import('eslint').Linter.RulesRecord} */ ({
// -- ordering and layout --
// groups and internal patterns are set by the imports layer
'import-x/order': 'error',
Expand Down Expand Up @@ -68,4 +68,14 @@ export default /** @type {import('eslint').Linter.RulesRecord} */ ({
'import-x/no-dynamic-require': 'error',
// Node built-ins are expected in Node projects; browser builds fail without polyfills anyway
'import-x/no-nodejs-modules': 'off',
// -- barrel files: a module that mostly re-exports others makes every importer load all of them --
'import-x/avoid-barrel-files': 'error',
// also through dependencies: import the module itself (lodash-es/debounce), not the package's barrel
'import-x/avoid-importing-barrel-files': 'error',
// `import * as x` hides which exports are used and defeats tree-shaking; import them by name
'import-x/avoid-namespace-import': 'error',
// `export * from` makes the API whatever the other module exports; name the exports
'import-x/avoid-re-export-all': 'error',
});

export default rules;
4 changes: 3 additions & 1 deletion src/eslint/rules/javascript.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* Core ESLint rules. Every non-deprecated core rule is listed; this table is the effective
* configuration (see docs/specs). Formatting is owned by Prettier.
*/
export default /** @type {import('eslint').Linter.RulesRecord} */ ({
const rules = /** @type {import('eslint').Linter.RulesRecord} */ ({
// possible logic errors
'array-callback-return': 'error',
'constructor-super': 'error',
Expand Down Expand Up @@ -242,3 +242,5 @@ export default /** @type {import('eslint').Linter.RulesRecord} */ ({
yoda: 'error',
'unicode-bom': 'error',
});

export default rules;
4 changes: 3 additions & 1 deletion src/eslint/rules/typescript.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Every rule in typescript-eslint's `all` config is listed; this table is the effective
* configuration for TS files.
*/
export default /** @type {import('eslint').Linter.RulesRecord} */ ({
const rules = /** @type {import('eslint').Linter.RulesRecord} */ ({
'@typescript-eslint/adjacent-overload-signatures': 'error',
'@typescript-eslint/array-type': 'error',
'@typescript-eslint/await-thenable': 'error',
Expand Down Expand Up @@ -231,3 +231,5 @@ export default /** @type {import('eslint').Linter.RulesRecord} */ ({
'@typescript-eslint/no-unnecessary-type-conversion': 'error',
'@typescript-eslint/no-generated-empty-object-type': 'error',
});

export default rules;
4 changes: 3 additions & 1 deletion src/eslint/rules/vitest.mjs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* @vitest/eslint-plugin rules. Every non-deprecated plugin rule is listed; effective configuration.
*/
export default /** @type {import('eslint').Linter.RulesRecord} */ ({
const rules = /** @type {import('eslint').Linter.RulesRecord} */ ({
// -- Assertions --
// helpers named expect* (e.g. expectValid(...)) count as assertions
'vitest/expect-expect': ['error', { assertFunctionNames: ['expect', 'expect*'] }],
Expand Down Expand Up @@ -121,3 +121,5 @@ export default /** @type {import('eslint').Linter.RulesRecord} */ ({
'vitest/padding-around-expect-groups': 'off',
'vitest/padding-around-test-blocks': 'off',
});

export default rules;
Loading
Loading