Skip to content

Commit eaf58e1

Browse files
authored
Merge pull request #27 from ember-template-lint/use-tsup
2 parents 99c9cba + 29c4461 commit eaf58e1

15 files changed

+991
-109
lines changed

.eslintignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
dist/
File renamed without changes.

.prettierrc.cjs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
module.exports = {
2+
singleQuote: true,
3+
trailingComma: 'es5',
4+
printWidth: 100,
5+
};

dist/index.cjs

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
var __create = Object.create;
2+
var __defProp = Object.defineProperty;
3+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4+
var __getOwnPropNames = Object.getOwnPropertyNames;
5+
var __getProtoOf = Object.getPrototypeOf;
6+
var __hasOwnProp = Object.prototype.hasOwnProperty;
7+
var __markAsModule = (target) => __defProp(target, "__esModule", { value: true });
8+
var __reExport = (target, module2, copyDefault, desc) => {
9+
if (module2 && typeof module2 === "object" || typeof module2 === "function") {
10+
for (let key of __getOwnPropNames(module2))
11+
if (!__hasOwnProp.call(target, key) && (copyDefault || key !== "default"))
12+
__defProp(target, key, { get: () => module2[key], enumerable: !(desc = __getOwnPropDesc(module2, key)) || desc.enumerable });
13+
}
14+
return target;
15+
};
16+
var __toESM = (module2, isNodeMode) => {
17+
return __reExport(__markAsModule(__defProp(module2 != null ? __create(__getProtoOf(module2)) : {}, "default", !isNodeMode && module2 && module2.__esModule ? { get: () => module2.default, enumerable: true } : { value: module2, enumerable: true })), module2);
18+
};
19+
20+
// src/index.ts
21+
var import_path = __toESM(require("path"), 1);
22+
var SONARQUBE_SEVERITY = {
23+
"-1": "INFO",
24+
1: "MINOR",
25+
2: "CRITICAL"
26+
};
27+
var SONARQUBE_TYPE = {
28+
"-1": "CODE_SMELL",
29+
1: "CODE_SMELL",
30+
2: "BUG"
31+
};
32+
module.exports = class SonarQubeFormatter {
33+
constructor(options) {
34+
this.defaultFileExtension = "json";
35+
this.options = options;
36+
}
37+
format(results) {
38+
const issues = [];
39+
if (this.options.hasResultData) {
40+
for (const filePath of Object.keys(results.files)) {
41+
let result = results.files[filePath];
42+
let relativePath = import_path.default.relative(this.options.workingDirectory, result.filePath);
43+
for (const message of result.messages) {
44+
issues.push({
45+
engineId: "ember-template-lint",
46+
ruleId: message.rule,
47+
severity: SONARQUBE_SEVERITY[message.severity],
48+
type: SONARQUBE_TYPE[message.severity],
49+
primaryLocation: {
50+
message: message.message,
51+
filePath: relativePath,
52+
textRange: {
53+
startLine: message.line,
54+
startColumn: message.column,
55+
endLine: message.endLine,
56+
endColumn: message.endColumn
57+
}
58+
}
59+
});
60+
}
61+
}
62+
}
63+
return JSON.stringify({ issues }, null, 2);
64+
}
65+
};

dist/index.d.ts

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
interface EmberTemplateLintOptions {
2+
hasResultData: true;
3+
workingDirectory: string;
4+
}
5+
interface EmberTemplateLintResults {
6+
files: {
7+
[x: string]: any;
8+
};
9+
}
10+
declare const _default: {
11+
new (options: EmberTemplateLintOptions): {
12+
defaultFileExtension: string;
13+
options: EmberTemplateLintOptions;
14+
format(results: EmberTemplateLintResults): string;
15+
};
16+
};
17+
18+
export { _default as default };

dist/index.js

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
var __getOwnPropNames = Object.getOwnPropertyNames;
2+
var __esm = (fn, res) => function __init() {
3+
return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
4+
};
5+
var __commonJS = (cb, mod) => function __require() {
6+
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
7+
};
8+
9+
// node_modules/tsup/assets/esm_shims.js
10+
var init_esm_shims = __esm({
11+
"node_modules/tsup/assets/esm_shims.js"() {
12+
}
13+
});
14+
15+
// src/index.ts
16+
import path from "path";
17+
var require_src = __commonJS({
18+
"src/index.ts"(exports, module) {
19+
init_esm_shims();
20+
var SONARQUBE_SEVERITY = {
21+
"-1": "INFO",
22+
1: "MINOR",
23+
2: "CRITICAL"
24+
};
25+
var SONARQUBE_TYPE = {
26+
"-1": "CODE_SMELL",
27+
1: "CODE_SMELL",
28+
2: "BUG"
29+
};
30+
module.exports = class SonarQubeFormatter {
31+
constructor(options) {
32+
this.defaultFileExtension = "json";
33+
this.options = options;
34+
}
35+
format(results) {
36+
const issues = [];
37+
if (this.options.hasResultData) {
38+
for (const filePath of Object.keys(results.files)) {
39+
let result = results.files[filePath];
40+
let relativePath = path.relative(this.options.workingDirectory, result.filePath);
41+
for (const message of result.messages) {
42+
issues.push({
43+
engineId: "ember-template-lint",
44+
ruleId: message.rule,
45+
severity: SONARQUBE_SEVERITY[message.severity],
46+
type: SONARQUBE_TYPE[message.severity],
47+
primaryLocation: {
48+
message: message.message,
49+
filePath: relativePath,
50+
textRange: {
51+
startLine: message.line,
52+
startColumn: message.column,
53+
endLine: message.endLine,
54+
endColumn: message.endColumn
55+
}
56+
}
57+
});
58+
}
59+
}
60+
}
61+
return JSON.stringify({ issues }, null, 2);
62+
}
63+
};
64+
}
65+
});
66+
export default require_src();

0 commit comments

Comments
 (0)