-
Notifications
You must be signed in to change notification settings - Fork 887
[FeatureRequest] Print absolute file path instead of relative #1794
Comments
You could probably write this pretty easily using a custom formatter |
Haha I came here to investigate the opposite problem (I only see absolute paths which are cluttering up the console). Maybe we should just switch machines, eh? |
With version @ 4.3.1 the output I see is even worse as its mixed relative and absolute! Some paths are relative and some are absolute. Obfuscated examples below C:/Users/tim/Documents/....ts[16, 19]: Array type using 'T[]' is forbidden for non-simple types. Use 'Array<T>' instead.
C:/Users/tim/Documents/.....ts[11, 14]: Use an interface instead of a type literal.
src/resources/....ts[14, 31]: Identifier 'lenk' is never reassigned; use 'const' instead of 'let'.
src/resources/....ts[79, 5]: Expected a 'for-of' loop instead of a 'for' loop with this simple iteration
src/resources/...ts[86, 5]: Expected a 'for-of' loop instead of a 'for' loop with this |
If it's useful to add, I also have mixed relative and absolute paths (on v4.0.2). At first I thought it was because of my set up (faking the application folder as an additional That said it hasn't impacted me personally because we use unix tools to filter and sort the output anyway and enough of the path remains to still identify everything easily. |
I'm using vscode and the console output pattern matcher has to define whether the paths are relative or absolute. This means that whichever way I configure it, some of the paths are not recognised. |
It is interesting how do you invoke TSLint so you have mixed path? Do you have any symlinks there? |
I'm using:
All plain old files with no symlinks
{
"extends": "tslint:latest",
"rules": {
"quotemark": [
true,
"single",
"avoid-escape"
],
"ordered-imports": [
false
],
"max-line-length": [
false
],
"max-classes-per-file": [
false
],
"trailing-comma": [
false
],
"no-trailing-whitespace": false,
"member-ordering": [
false
],
"object-literal-sort-keys": false,
"no-empty": false,
"object-literal-key-quotes": [
false
],
"no-unused-variable": true,
"radix": false,
"no-null-keyword": true,
"no-angle-bracket-type-assertion": true,
"triple-equals": [
true,
"allow-undefined-check"
],
"arrow-parens": false,
"array-type": [
true,
"array"
],
"prefer-const": true,
"prefer-for-of": false
}
}
{
"compileOnSave": false,
"compilerOptions": {
"allowJs": true,
"rootDir": "./src/",
"outDir": "./www/dist/",
"inlineSources": true,
"inlineSourceMap": true,
"target": "es5",
"module": "system",
"declaration": false,
"noImplicitAny": true,
"strictNullChecks": false,
"removeComments": false,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"moduleResolution": "node",
"lib": [
"es2015",
"dom"
]
},
"include": [
"./node_modules/@types/**/*.d.ts",
"./www/jspm_packages/**/*.d.ts",
"./typings/index.d.ts",
"./typings/custom/**/*.d.ts",
"./src/**/*.ts"
],
"exclude": [
"./src/**/*spec.ts",
"node_modules",
"platforms",
"www"
]
} |
No symlinks here. My command is: tslint --type-check --config config/tslint.json --project tsconfig.json I usually run this via npm scripts. I don't think there's anything notable in my tslint config (just enabling rules and setting the custom directory). For tsconfig, I'm using As previously mentioned, I use some module-style imports to access local files like so:
But I've experimented with traditional relative imports and that seems to have no bearing on the mixed paths issue. I can try to double-check this again soon though. |
Here are some slightly less obfuscated warnings, this time with msbuild formatter. Points to note:
c:/Users/tim/Documents/Project/src/components/confirm-dialog.ts(25,1): warning maxClassesPerFile: A maximum of 1 class per file is allowed
c:/Users/tim/Documents/Project/src/components/confirm-dialog.ts(31,1): warning maxClassesPerFile: A maximum of 1 class per file is allowed
c:/Users/tim/Documents/Project/src/components/confirm-dialog.ts(37,1): warning maxClassesPerFile: A maximum of 1 class per file is allowed
c:/Users/tim/Documents/Project/src/components/confirm-dialog.ts(43,1): warning maxClassesPerFile: A maximum of 1 class per file is allowed
c:/Users/tim/Documents/Project/src/devices/controls/edit-channel/dialog.ts(156,1): warning maxClassesPerFile: A maximum of 1 class per file is allowed
c:/Users/tim/Documents/Project/src/devices/controls/edit-channel/dialog.ts(162,1): warning maxClassesPerFile: A maximum of 1 class per file is allowed
c:/Users/tim/Documents/Project/src/devices/controls/edit-channel/dialog.ts(168,1): warning maxClassesPerFile: A maximum of 1 class per file is allowed
c:/Users/tim/Documents/Project/src/devices/controls/edit-channel/dialog.ts(174,1): warning maxClassesPerFile: A maximum of 1 class per file is allowed
c:/Users/tim/Documents/Project/src/utils/color/color-convert.ts(31,1): warning maxClassesPerFile: A maximum of 1 class per file is allowed
c:/Users/tim/Documents/Project/src/devices/dal/device-configure.ts(66,13): warning typeofCompare: typeof must be compared to correct value
src/graph/components/axis/x-axis.ts(42,1): warning maxClassesPerFile: A maximum of 1 class per file is allowed
src/graph/components/axis/y-axis.ts(34,1): warning maxClassesPerFile: A maximum of 1 class per file is allowed |
I've also started experiencing mixed relative and absolute paths in the output, but I think I know what caused it (roughly). All my paths were relative until I added some rules which required type checking, then I switched to using This is using Windows 7. I just confirmed that removing those rules and going back to the glob instead of the project that they all return to relative. Mine switch back and forth between absolute and relative a couple times. The rules don't seem to matter, but the paths for a single file tend to always be the same style. |
For all the VSCode Users, you can replace the problemMatcher in your task with this one, it will distinguish between absolute (C:/, D:/,...) Windows Paths, and relative ones (src/app/...)
Now i get warnings in the Problems Tab! |
For osx/linux users: "problemMatcher": [
{
"base": "$tslint5",
"fileLocation": "absolute",
"pattern": {
"regexp": "^(WARNING|ERROR):(\\s+\\(/\\S*\\))?\\s+(/\\S.*)\\[(\\d+), (\\d+)\\]:\\s+(.*)$",
"severity": 1,
"file": 3,
"line": 4,
"column": 5,
"message": 6
}
},
{
"base": "$tslint5",
"fileLocation": "relative",
"pattern": {
"regexp": "^(WARNING|ERROR):(\\s+\\(/\\S*\\))?\\s+([^/]\\S.*)\\[(\\d+), (\\d+)\\]:\\s+(.*)$",
"severity": 1,
"file": 3,
"line": 4,
"column": 5,
"message": 6
}
}
] |
Feature request
Hello, I'm using tslint with Webstorm and it would be nice to have tappable linter output. Currently tslint can print only relative file path, but Webstorm requires absolute path :(
Actual result:
Expected result:
The text was updated successfully, but these errors were encountered: