codelyzer icon indicating copy to clipboard operation
codelyzer copied to clipboard

Lowercase File Paths In Output

Open rgant opened this issue 6 years ago • 0 comments

Rules that apply to templates lowercase the file paths. (Perhaps only on macOS.) This makes tools trying to identify the location of the file not be able to do a string comparison.

This happens both when I run ng lint in my Angular project, and when I run manually:

Euphorbus:~/Programming/LearnLux/learnlux-app (master *$)$ tslint --project ./ --format verbose src/app/budget/list/list.component.ts
ERROR: (prefer-readonly) /Users/rgant/Programming/LearnLux/learnlux-app/src/app/budget/list/list.component.ts[29, 13]: Private member variable 'budgetService' is never reassigned; mark it as 'readonly'.
ERROR: (template-use-track-by-function) /users/rgant/programming/learnlux/learnlux-app/src/app/budget/list/list.component.html[9, 25]: Missing trackBy function in ngFor directive
ERROR: (template-use-track-by-function) /users/rgant/programming/learnlux/learnlux-app/src/app/budget/list/list.component.html[113, 22]: Missing trackBy function in ngFor directive
ERROR: (template-use-track-by-function) /users/rgant/programming/learnlux/learnlux-app/src/app/budget/list/list.component.html[135, 22]: Missing trackBy function in ngFor directive

Note how the first error has /Users/rgant/Programming/LearnLux/ with capital Users, Programming, and LearnLux. But the other errors have /users/rgant/programming/learnlux/ with only lowercase characters.

Context and configuration

I've seen this with both the template-use-track-by-function and template-no-call-expression but I think it is all the template rules.

tsconfig.json
{
  "compileOnSave": false,
  "compilerOptions": {
    "baseUrl": "./",
    "declaration": false,
    "downlevelIteration": true,
    "emitDecoratorMetadata": true,
    "experimentalDecorators": true,
    "forceConsistentCasingInFileNames": true,
    "importHelpers": true,
    "lib": [
      "es2018",
      "dom"
    ],
    "module": "esnext",
    "moduleResolution": "node",
    "noImplicitReturns": true,
    "noUnusedLocals": true,
    "noUnusedParameters": true,
    "outDir": "./dist/out-tsc",
    "paths": {
      "@app/*": ["src/app/*"],
      "@env/*": ["src/environments/*"],
      "@testing/*": ["src/testing/*"]
    },
    "sourceMap": true,
    "strict": true,
    "suppressImplicitAnyIndexErrors": true,
    "target": "es2015",
    "typeRoots": [
      "node_modules/@types"
    ]
  },
  "angularCompilerOptions": {
    "fullTemplateTypeCheck": true,
    "strictInjectionParameters": true
  }
}

I don't have a ~/.codelyzer.js file.

To Reproduce

tslint.json
{
  "extends": [
    "tslint:recommended"
  ],
  "rules": {
    "template-accessibility-alt-text": true,
    "template-accessibility-elements-content": true,
    "template-accessibility-label-for": true,
    "template-accessibility-tabindex-no-positive": true,
    "template-accessibility-table-scope": true,
    "template-accessibility-valid-aria": true,
    "template-banana-in-box": true,
    "template-click-events-have-key-events": false,
    "template-conditional-complexity": true,
    "template-cyclomatic-complexity": false,
    "template-i18n": [
        "check-id",
        "check-text",
        true
    ],
    "template-mouse-events-have-key-events": false,
    "template-no-autofocus": false,
    "template-no-call-expression": true,
    "template-no-distracting-elements": true,
    "template-no-negated-async": true,
    "template-use-track-by-function": true,
  },
  "rulesDirectory": [
    "codelyzer"
  ]
}

Introduce some errors in the templates that would trigger the configured rules. Run the linter.

Expected behavior

Expected the file paths to be canonical with default character cases.

Environment

  • Version 5.1.0
  • OS: macOS Mojave 10.14.6
  • node: '10.16.0'
  • npm: '6.9.0'
  • Angular CLI: 8.3.2
  • Angular: 8.2.4
  • 5.15.0

rgant avatar Sep 26 '19 13:09 rgant