diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 0b0b36103..502b1b2b5 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -52,7 +52,7 @@ jobs: pnpm nx release version $VERSION - name: Publish packages to npm - run: pnpm nx release publish --registry https://registry.npmjs.org + run: pnpm nx release publish --registry https://registry.npmjs.org --tag previous env: NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} NPM_CONFIG_PROVENANCE: true diff --git a/CHANGELOG.md b/CHANGELOG.md index f5b5a861a..049e96d93 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,13 @@ +## 19.8.1 (2025-06-19) + +### 🩹 Fixes + +- **eslint-plugin-template:** [no-interpolation-in-attributes] use keySpan as attr. range and sourceSpan as replacement range ([#2531](https://github.com/angular-eslint/angular-eslint/pull/2531)) + +### ❤️ Thank You + +- Niklas Wolf + ## 19.8.0 (2025-06-06) ### 🚀 Features diff --git a/packages/angular-eslint/CHANGELOG.md b/packages/angular-eslint/CHANGELOG.md index 92f643b7a..e0b3d77c9 100644 --- a/packages/angular-eslint/CHANGELOG.md +++ b/packages/angular-eslint/CHANGELOG.md @@ -1,3 +1,7 @@ +## 19.8.1 (2025-06-19) + +This was a version bump only for angular-eslint to align it with other projects, there were no code changes. + ## 19.8.0 (2025-06-06) This was a version bump only for angular-eslint to align it with other projects, there were no code changes. diff --git a/packages/angular-eslint/package.json b/packages/angular-eslint/package.json index a73ee7a86..e0b002fc4 100644 --- a/packages/angular-eslint/package.json +++ b/packages/angular-eslint/package.json @@ -1,6 +1,6 @@ { "name": "angular-eslint", - "version": "19.8.0", + "version": "19.8.1", "description": "The tooling which enables ESLint to work with Angular projects", "license": "MIT", "main": "dist/index.js", diff --git a/packages/builder/CHANGELOG.md b/packages/builder/CHANGELOG.md index ddc48b864..c9cd1e8ae 100644 --- a/packages/builder/CHANGELOG.md +++ b/packages/builder/CHANGELOG.md @@ -1,3 +1,7 @@ +## 19.8.1 (2025-06-19) + +This was a version bump only for builder to align it with other projects, there were no code changes. + ## 19.8.0 (2025-06-06) This was a version bump only for builder to align it with other projects, there were no code changes. diff --git a/packages/builder/package.json b/packages/builder/package.json index a1e03e64e..c447c6bdb 100644 --- a/packages/builder/package.json +++ b/packages/builder/package.json @@ -1,6 +1,6 @@ { "name": "@angular-eslint/builder", - "version": "19.8.0", + "version": "19.8.1", "description": "Angular CLI builder for ESLint", "license": "MIT", "main": "dist/index.js", diff --git a/packages/bundled-angular-compiler/CHANGELOG.md b/packages/bundled-angular-compiler/CHANGELOG.md index ae163691e..d1869a56c 100644 --- a/packages/bundled-angular-compiler/CHANGELOG.md +++ b/packages/bundled-angular-compiler/CHANGELOG.md @@ -1,3 +1,7 @@ +## 19.8.1 (2025-06-19) + +This was a version bump only for bundled-angular-compiler to align it with other projects, there were no code changes. + ## 19.8.0 (2025-06-06) This was a version bump only for bundled-angular-compiler to align it with other projects, there were no code changes. diff --git a/packages/bundled-angular-compiler/package.json b/packages/bundled-angular-compiler/package.json index a4b6da9a2..58254cb33 100644 --- a/packages/bundled-angular-compiler/package.json +++ b/packages/bundled-angular-compiler/package.json @@ -1,6 +1,6 @@ { "name": "@angular-eslint/bundled-angular-compiler", - "version": "19.8.0", + "version": "19.8.1", "description": "A CJS bundled version of @angular/compiler", "license": "MIT", "main": "dist/index.js", diff --git a/packages/eslint-plugin-template/CHANGELOG.md b/packages/eslint-plugin-template/CHANGELOG.md index 58a39cf4c..e504d7f7e 100644 --- a/packages/eslint-plugin-template/CHANGELOG.md +++ b/packages/eslint-plugin-template/CHANGELOG.md @@ -1,3 +1,13 @@ +## 19.8.1 (2025-06-19) + +### 🩹 Fixes + +- **eslint-plugin-template:** [no-interpolation-in-attributes] use keySpan as attr. range and sourceSpan as replacement range ([#2531](https://github.com/angular-eslint/angular-eslint/pull/2531)) + +### ❤️ Thank You + +- Niklas Wolf + ## 19.8.0 (2025-06-06) ### 🚀 Features diff --git a/packages/eslint-plugin-template/docs/rules/no-interpolation-in-attributes.md b/packages/eslint-plugin-template/docs/rules/no-interpolation-in-attributes.md index d195c647d..9bf7813f2 100644 --- a/packages/eslint-plugin-template/docs/rules/no-interpolation-in-attributes.md +++ b/packages/eslint-plugin-template/docs/rules/no-interpolation-in-attributes.md @@ -112,6 +112,33 @@ interface Options {
+#### Default Config + +```json +{ + "rules": { + "@angular-eslint/template/no-interpolation-in-attributes": [ + "error" + ] + } +} +``` + +
+ +#### ❌ Invalid Code + +```html + + ~~~~~~~~~ +``` + +
+ +--- + +
+ #### Custom Config ```json diff --git a/packages/eslint-plugin-template/package.json b/packages/eslint-plugin-template/package.json index 4788cac45..b4d9e23ae 100644 --- a/packages/eslint-plugin-template/package.json +++ b/packages/eslint-plugin-template/package.json @@ -1,6 +1,6 @@ { "name": "@angular-eslint/eslint-plugin-template", - "version": "19.8.0", + "version": "19.8.1", "description": "ESLint plugin for Angular Templates", "license": "MIT", "main": "dist/index.js", diff --git a/packages/eslint-plugin-template/src/rules/no-interpolation-in-attributes.ts b/packages/eslint-plugin-template/src/rules/no-interpolation-in-attributes.ts index 4f09d31a3..daa4e9796 100644 --- a/packages/eslint-plugin-template/src/rules/no-interpolation-in-attributes.ts +++ b/packages/eslint-plugin-template/src/rules/no-interpolation-in-attributes.ts @@ -73,7 +73,11 @@ export default createESLintRule({ messageId: 'noInterpolationInAttributes', fix: isFullInterpolation ? (fixer) => { - const attributeName = boundAttribute.name.trim(); + const attrStart = boundAttribute.keySpan.start.offset; + const attrEnd = boundAttribute.keySpan.end.offset; + const attributeName = sourceCode.text + .slice(attrStart, attrEnd) + .trim(); const exprStart = boundAttribute.valueSpan.start.offset + 2; // +2 to remove '{{' const exprEnd = boundAttribute.valueSpan.end.offset - 2; // -2 to remove '}}' @@ -81,12 +85,12 @@ export default createESLintRule({ .slice(exprStart, exprEnd) .trim(); + const rangeStart = boundAttribute.sourceSpan.start.offset; + const rangeEnd = boundAttribute.sourceSpan.end.offset; + const replacement = `[${attributeName}]="${expression}"`; return fixer.replaceTextRange( - [ - boundAttribute.keySpan.start.offset, - boundAttribute.valueSpan.end.offset, - ], - `[${attributeName}]="${expression}`, // Replace with property binding. Leave out the last quote since its automatically added. + [rangeStart, rangeEnd], + replacement, ); } : null, diff --git a/packages/eslint-plugin-template/tests/rules/no-interpolation-in-attributes/cases.ts b/packages/eslint-plugin-template/tests/rules/no-interpolation-in-attributes/cases.ts index 4a31f27f2..72a66f95c 100644 --- a/packages/eslint-plugin-template/tests/rules/no-interpolation-in-attributes/cases.ts +++ b/packages/eslint-plugin-template/tests/rules/no-interpolation-in-attributes/cases.ts @@ -45,6 +45,19 @@ export const invalid: readonly InvalidTestCase[] = [ `, messageId, }), + convertAnnotatedSourceToFailureCase({ + description: + 'it should fail and autofix the full attribute if interpolation is used as attribute value', + annotatedSource: ` + + ~~~~~~~~~ + `, + messageId, + annotatedOutput: ` + + + `, + }), convertAnnotatedSourceToFailureCase({ description: 'it should fail and not autofix when interpolation is used as part of attribute value and this is explicitly configured as disallowed', diff --git a/packages/eslint-plugin/CHANGELOG.md b/packages/eslint-plugin/CHANGELOG.md index e7fd6da5e..f320c3a4a 100644 --- a/packages/eslint-plugin/CHANGELOG.md +++ b/packages/eslint-plugin/CHANGELOG.md @@ -1,3 +1,7 @@ +## 19.8.1 (2025-06-19) + +This was a version bump only for eslint-plugin to align it with other projects, there were no code changes. + ## 19.8.0 (2025-06-06) This was a version bump only for eslint-plugin to align it with other projects, there were no code changes. diff --git a/packages/eslint-plugin/package.json b/packages/eslint-plugin/package.json index cb7931b05..89ba33f6e 100644 --- a/packages/eslint-plugin/package.json +++ b/packages/eslint-plugin/package.json @@ -1,6 +1,6 @@ { "name": "@angular-eslint/eslint-plugin", - "version": "19.8.0", + "version": "19.8.1", "description": "ESLint plugin for Angular applications, following https://angular.dev/style-guide", "license": "MIT", "main": "dist/index.js", diff --git a/packages/schematics/CHANGELOG.md b/packages/schematics/CHANGELOG.md index 4346caf64..d08aeaf18 100644 --- a/packages/schematics/CHANGELOG.md +++ b/packages/schematics/CHANGELOG.md @@ -1,3 +1,7 @@ +## 19.8.1 (2025-06-19) + +This was a version bump only for schematics to align it with other projects, there were no code changes. + ## 19.8.0 (2025-06-06) This was a version bump only for schematics to align it with other projects, there were no code changes. diff --git a/packages/schematics/package.json b/packages/schematics/package.json index 46a6008c3..4cf11258b 100644 --- a/packages/schematics/package.json +++ b/packages/schematics/package.json @@ -1,6 +1,6 @@ { "name": "@angular-eslint/schematics", - "version": "19.8.0", + "version": "19.8.1", "description": "Angular Schematics for angular-eslint", "license": "MIT", "main": "dist/index.js", diff --git a/packages/template-parser/CHANGELOG.md b/packages/template-parser/CHANGELOG.md index 6790063b7..07c0b5320 100644 --- a/packages/template-parser/CHANGELOG.md +++ b/packages/template-parser/CHANGELOG.md @@ -1,3 +1,7 @@ +## 19.8.1 (2025-06-19) + +This was a version bump only for template-parser to align it with other projects, there were no code changes. + ## 19.8.0 (2025-06-06) This was a version bump only for template-parser to align it with other projects, there were no code changes. diff --git a/packages/template-parser/package.json b/packages/template-parser/package.json index c0c2c6852..f039ae65d 100644 --- a/packages/template-parser/package.json +++ b/packages/template-parser/package.json @@ -1,6 +1,6 @@ { "name": "@angular-eslint/template-parser", - "version": "19.8.0", + "version": "19.8.1", "description": "Angular Template parser for ESLint", "license": "MIT", "main": "dist/index.js", diff --git a/packages/test-utils/CHANGELOG.md b/packages/test-utils/CHANGELOG.md index 0f108333f..c4db4fec6 100644 --- a/packages/test-utils/CHANGELOG.md +++ b/packages/test-utils/CHANGELOG.md @@ -1,3 +1,7 @@ +## 19.8.1 (2025-06-19) + +This was a version bump only for @angular-eslint/test-utils to align it with other projects, there were no code changes. + ## 19.8.0 (2025-06-06) This was a version bump only for @angular-eslint/test-utils to align it with other projects, there were no code changes. diff --git a/packages/test-utils/package.json b/packages/test-utils/package.json index 5f648dc25..6c8ee74bf 100644 --- a/packages/test-utils/package.json +++ b/packages/test-utils/package.json @@ -1,6 +1,6 @@ { "name": "@angular-eslint/test-utils", - "version": "19.8.0", + "version": "19.8.1", "license": "MIT", "main": "dist/index.js", "types": "dist/index.d.ts", diff --git a/packages/utils/CHANGELOG.md b/packages/utils/CHANGELOG.md index 639790235..cb105c8d2 100644 --- a/packages/utils/CHANGELOG.md +++ b/packages/utils/CHANGELOG.md @@ -1,3 +1,7 @@ +## 19.8.1 (2025-06-19) + +This was a version bump only for @angular-eslint/utils to align it with other projects, there were no code changes. + ## 19.8.0 (2025-06-06) This was a version bump only for @angular-eslint/utils to align it with other projects, there were no code changes. diff --git a/packages/utils/package.json b/packages/utils/package.json index db3684ab4..beb15cad2 100644 --- a/packages/utils/package.json +++ b/packages/utils/package.json @@ -1,6 +1,6 @@ { "name": "@angular-eslint/utils", - "version": "19.8.0", + "version": "19.8.1", "license": "MIT", "main": "dist/index.js", "types": "dist/index.d.ts",