i18n rule with check-id and check-text does not handle the ng-container tag
还没有人认领这个 Issue。
评估
- 难度
- 3/5
- 预计耗时
- 1-2 天
- 新手友好度
- 35/100
- Issue 类型
- 缺陷
- 描述清晰度
- 基本清楚
- 活跃度
- 停滞
- 技术栈
- angular, typescript
- 领域
- tooling
调研方向
运行仓库的 npm run test 命令,并检查 i18n 的 check-id 测试,包括 dist/test/i18nRule.spec.js 中所示的失败 ng-container 案例和通过的 span 案例。跟踪 check-id 和 check-text 的规则行为;完成的标准是 ng-container i18n="@@foo" 测试通过,且现有案例不发生回归。
由索引模型根据 Issue 内容生成。
描述
Reference: PR #506
Today I updated to version 4.2.1 of Codelyzer, as I was finding the linter was incorrectly reporting errors with our use of select ICU expressions (see: https://angular.io/guide/i18n#translate-select). PR #506 seems to have addressed those issues (thanks!). Unfortunately, I'm now finding that when I use ng-container tags with i18n ids (see: https://angular.io/guide/i18n#translate-text-without-creating-an-element) I get linting errors, that I don't expect.
I've cloned the repo, locally adding 2 tests to the suite. They're identical tests except for the use of different tags (ng-container vs span). As you'll see further below ng-container fails while span works fine:
66 it('NEW [ng-container]: should work with proper id', () => {
67 const source = `
68 @Component({
69 template: \`
70 <ng-container i18n="@@foo">Text</ng-container>
71 \`
72 })
73 class Bar {}
74 `;
75 assertSuccess('i18n', source, ['check-id', 'check-text']);
76 });
77
78 it('NEW [span]: should work with proper id', () => {
79 const source = `
80 @Component({
81 template: \`
82 <span i18n="@@foo">Text</span>
83 \`
84 })
85 class Bar {}
86 `;
87 assertSuccess('i18n', source, ['check-id', 'check-text']);
88 });
This is the output:
node@3bb72aa7d7e3:/codelyzer$ npm run test
npm info it worked if it ends with ok
npm info using [email protected]
npm info using [email protected]
npm info lifecycle [email protected]~pretest: [email protected]
npm info lifecycle [email protected]~test: [email protected]
> [email protected] test /codelyzer
> rimraf dist && tsc && cp -r test/fixtures dist/test && mocha dist/test --recursive
i18n
check-id
✓ should work with proper id (50ms)
✓ should work with proper i18n attribute
✓ should work with proper id
✓ should work with proper id
1) NEW [ng-container]: should work with proper id
✓ NEW [span]: should work with proper id
✓ should fail with missing id string
✓ should fail with missing id
✓ should fail with missing id
8 passing (130ms)
1 failing
1) i18n check-id NEW [ng-container]: should work with proper id:
AssertionError: expected false to be true
at Function.assert.isTrue (node_modules/chai/lib/chai/interface/assert.js:332:31)
at Object.assertSuccess (dist/test/testHelper.js:161:17)
at Context.<anonymous> (dist/test/i18nRule.spec.js:30:26)
npm info lifecycle [email protected]~test: Failed to exec test script
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] test: `rimraf dist && tsc && cp -r test/fixtures dist/test && mocha dist/test --recursive`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] test script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /home/node/.npm/_logs/2018-03-04T17_39_02_030Z-debug.log
One caveat, is that I don't see any tests in which both check-id and check-text are set so it's possible I shouldn't be configuring the linter to use both. Not sure. This is the line that I have in my tslint file:
"i18n": [true, "check-id", "check-text"]
- 主要语言
- TypeScript
- 星标
- 2.5k
- 派生
- 232
- PR 合并指标
- 30 天内没有已合并 PR
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 没有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
mgechev/codelyzer 的其他 Issue
-
难度 3/5 1-2 天 新手友好度 35/100
-
难度 4/5 3-5 天 新手友好度 35/100
-
难度 2/5 1-3 小时 新手友好度 32/100
-
Angular 14未关闭
难度 2/5 1-3 小时 新手友好度 35/100
-
Support for Angular 10可能已有人在做 @ccarmesin 于 1842 天前认领。 未关闭
难度 3/5 1-2 天 新手友好度 25/100
查看 mgechev/codelyzer 的全部 Issue
相似的 Issue
-
agent-ready area: ui-server priority: p3 type: test
难度 2/5 1-3 小时 新手友好度 78/100
schlessera/brain-kit#4249 ·
维护者通常 1 天内回复
-
documentation tool triaged
难度 2/5 1-3 小时 新手友好度 73/100
can1357/oh-my-pi#19608 · 2 条评论 ·
维护者通常 1 天内回复
-
dependencies tech-debt
难度 2/5 1-3 小时 新手友好度 65/100
bcgov/nr-waste-plus#1549 ·
维护者通常 1 天内回复
-
enhancement good first issue
难度 2/5 1-3 小时 新手友好度 78/100
blixvip/solana-token-meta#17 ·
-
enhancement good first issue
难度 2/5 1-3 小时 新手友好度 78/100
blixvip/solana-tx-parse#18 ·