Thank you for the instructions Julien. I did like you described and came with the following observations:
SonarLint uses the same profile (I compared the id), which contains typescript:S106
, typescript:S121
and typescript:S1440
, but somehow does not apply these and other rules. (On the SonarQube server they are applied)
From the logs, I examined the following information about the rules:
* ts: 230 active rules
Rule typescript:S5728 is enabled on the server, but not available in SonarLint
Rule typescript:S5604 is enabled on the server, but not available in SonarLint
Rule typescript:S5725 is enabled on the server, but not available in SonarLint
Rule typescript:S5730 is enabled on the server, but not available in SonarLint
Rule typescript:S5732 is enabled on the server, but not available in SonarLint
Rule typescript:S6268 is enabled on the server, but not available in SonarLint
Rule typescript:S5852 is enabled on the server, but not available in SonarLint
Rule typescript:S5739 is enabled on the server, but not available in SonarLint
Rule typescript:S5734 is enabled on the server, but not available in SonarLint
Rule typescript:S5736 is enabled on the server, but not available in SonarLint
Rule typescript:S5743 is enabled on the server, but not available in SonarLint
Rule typescript:S5742 is enabled on the server, but not available in SonarLint
Rule typescript:S2245 is enabled on the server, but not available in SonarLint
Rule typescript:S3330 is enabled on the server, but not available in SonarLint
Rule typescript:S5759 is enabled on the server, but not available in SonarLint
Rule typescript:S5757 is enabled on the server, but not available in SonarLint
Rule typescript:S6299 is enabled on the server, but not available in SonarLint
Rule typescript:S4790 is enabled on the server, but not available in SonarLint
Rule typescript:S5443 is enabled on the server, but not available in SonarLint
Rule typescript:S5689 is enabled on the server, but not available in SonarLint
Rule typescript:S1523 is enabled on the server, but not available in SonarLint
Rule typescript:S2612 is enabled on the server, but not available in SonarLint
Rule typescript:S5691 is enabled on the server, but not available in SonarLint
Rule typescript:S2068 is enabled on the server, but not available in SonarLint
Rule typescript:S5693 is enabled on the server, but not available in SonarLint
Rule typescript:S5332 is enabled on the server, but not available in SonarLint
Rule typescript:S2077 is enabled on the server, but not available in SonarLint
Rule typescript:S1313 is enabled on the server, but not available in SonarLint
Rule typescript:S2092 is enabled on the server, but not available in SonarLint
Rule typescript:S4036 is enabled on the server, but not available in SonarLint
Rule typescript:S5247 is enabled on the server, but not available in SonarLint
Rule typescript:S5122 is enabled on the server, but not available in SonarLint
Rule typescript:S4721 is enabled on the server, but not available in SonarLint
Rule typescript:S4507 is enabled on the server, but not available in SonarLint
Rule typescript:S4502 is enabled on the server, but not available in SonarLint
Rule typescript:S5042 is enabled on the server, but not available in SonarLint
As you can see, the upper discussed three rules are not presented here (that’s why I am saying that SonarLint ignores other rules also). From the remaining logs I found other pieces of information which potentially may give a direction for a solution.
...
Execute Sensor: TypeScript analysis
eslint-bridge server is up, no need to start.
Analysis of unchanged files will not be skipped (current analysis requires all files to be analyzed)
Initializing linter "default" with max-statements-per-line,curly,no-commented-code,sonar-no-fallthrough,duplicates-in-character-class,no-inverted-boolean-check,file-uploads,sonar-no-misleading-character-class,arguments-order,no-same-argument-assert,no-unsafe-finally,prefer-while,unused-named-groups,single-character-alternation,nested-control-flow,sonar-max-lines-per-function,no-use-of-empty-return-value,session-regeneration,no-associative-arrays,no-weak-keys,no-useless-increment,weak-ssl,no-throw-literal,no-redundant-optional,post-message,constructor-for-side-effects,prefer-readonly,no-redeclare,no-globals-shadowing,bool-param-default,unverified-hostname,for-loop-increment-sign,no-return-await,no-nested-conditional,no-unnecessary-type-assertion,no-implicit-dependencies,insecure-jwt-token,no-dead-store,no-this-alias,prefer-const,prefer-type-guard,no-return-type-any,no-unused-function-argument,use-type-alias,no-in-misuse,no-parameter-reassignment,no-incorrect-string-concat,class-prototype,updated-loop-counter,concise-regex,stateful-regex,test-check-exception,no-extra-semi,max-switch-cases,no-undefined-argument,no-labels,cognitive-complexity,max-union-size,use-isnan,no-shadow,inverted-assertion-arguments,no-nested-template-literals,no-duplicate-in-composite,generator-without-yield,no-ignored-return,no-caller,no-redundant-parentheses,call-argument-line,no-unenclosed-multiline-block,no-redundant-boolean,prefer-immediate-return,prefer-promise-shorthand,no-template-curly-in-string,regex-complexity,no-empty-after-reluctant,assertions-in-tests,unused-import,empty-string-repetition,no-nested-assignment,index-of-compare-to-positive-number,file-name-differ-from-class,todo-tag,prefer-default-last,no-gratuitous-expressions,no-empty-pattern,sonar-no-invalid-regexp,anchor-precedence,fixme-tag,no-trailing-spaces,no-nested-incdec,non-existent-operator,new-operator-misuse,no-small-switch,no-for-in-iterable,prefer-for-of,default-param-last,xml-parser-xxe,no-global-this,no-array-delete,no-alphabetical-sort,consistent-type-assertions,adjacent-overload-signatures,cyclomatic-complexity,no-sequences,void-use,no-octal,comma-or-logical-or-case,label-position,conditional-indentation,existing-groups,semi,super-invocation,no-try-promise,sonar-no-control-regex,no-empty-alternatives,sonar-no-regex-spaces,prefer-regex-literals,no-same-line-conditional,no-empty-interface,no-identical-functions,no-element-overwrite,no-equals-in-for-termination,no-sparse-arrays,no-var,no-redundant-jump,no-duplicate-imports,no-unthrown-error,no-unnecessary-type-arguments,no-collection-size-mischeck,prefer-namespace-keyword,unverified-certificate,no-empty-collection,no-empty-group,quotes,eqeqeq,no-accessor-field-mismatch,no-unused-collection,no-invariant-returns,radix,no-case-label-in-switch,prefer-template,no-built-in-override,arguments-usage,destructuring-assignment-syntax,no-misleading-array-reverse,no-redundant-assignments,no-inconsistent-returns,no-all-duplicated-branches,no-identical-conditions,no-weak-cipher,no-delete-var,encryption-secure-mode,strings-comparison,no-useless-intersection,sonar-block-scoped-var,expression-complexity,no-empty-function,no-code-after-done,no-unsafe-negation,no-non-null-assertion,deprecation,misplaced-loop-counter,no-one-iteration-loop,no-multi-str,function-inside-loop,object-shorthand,no-inferrable-types,no-duplicated-branches,no-duplicate-string,disabled-timeout,bitwise-operators,class-name,array-constructor,sonar-max-lines,no-console,no-identical-expressions,no-unreachable,no-useless-catch,no-variable-usage-before-declaration,no-incomplete-assertions,chai-determinate-assertion,eol-last,variable-name,no-primitive-wrappers,no-exclusive-tests,no-self-assign,no-misused-new,no-invalid-await,no-function-declaration-in-block,no-empty,sonar-max-params,no-magic-numbers,no-unused-expressions
Resolving TSConfig files using './tsconfig.json' from property sonar.typescript.tsconfigPath
Using './tsconfig.json' to resolve TSConfig file(s)
Found 1 TSConfig file(s): [D:\Workspaces\<project-name>\.\tsconfig.json]
D:/Workspaces/<project-name>/src/app/components/partials/navigation/navigation.component.ts matched NO_CONFIG
Skipping 1 files with no tsconfig.json
Skipped files: [uri=file:///D:/Workspaces/<project-name>/src/app/components/partials/navigation/navigation.component.ts]
1 source file to be analyzed
1/1 source file has been analyzed
Hit the cache for 0 out of 0
Miss the cache for 0 out of 0
...
The file where typescript:S1440
and typescript:S121
must be detected is the one from the logs, namely navigation.component.ts
. But maybe because there are not applied, the file is skipped. I don’t know if the fact that I have no specified property sonar.typescript.tsconfigPath
in my sonar-project.properties
might be a cause. (Maybe not, since it finds the file and the issues are rendered on the SonarQube server). Any idea where the issue might be?