Skip to content

Commit a5c2877

Browse files
committed
chore: Revert "refactor(package-json): optimize npm pre* and *-ci scripts, remove custom formatter"
This reverts commit 749bd83. # Conflicts: # .teamcity/src/builds/UnitTestsAndBuild.kt # package.json
1 parent 34aa78c commit a5c2877

File tree

3 files changed

+47
-2
lines changed

3 files changed

+47
-2
lines changed

.teamcity/src/builds/UnitTestsAndBuild.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,8 @@ object UnitTestsAndBuild : BuildType({
6060
mkdir node_modules
6161
npm install
6262
63-
npm run type-check
64-
npm run lint || true
63+
npm run type-check-ci
64+
npm run lint-ci || true
6565
npm run test || true
6666
npm run build
6767
npm run build-stories

package.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,8 @@
5656
"figma-connect-unpublish": "npx figma connect unpublish --token=$FIGMA_CODE_CONNECT_TOKEN",
5757
"figma-connect-unpublish-local": "dotenv -- npm run figma-connect-unpublish",
5858
"lint": "npm run lint:js && npm run stylelint",
59+
"prelint-ci": "echo \"##teamcity[importData type='jslint' path='eslint-report.xml']\"",
60+
"lint-ci": "eslint --format jslint-xml . > eslint-report.xml && npm run stylelint-ci",
5961
"lint:js": "eslint",
6062
"postbuild": "cpy './**/*.d.ts' ../dist --parents --cwd=components/",
6163
"postinstall": "husky && npm run postinstall:gitconfig",
@@ -79,12 +81,14 @@
7981
"start": "storybook dev -p 9999",
8082
"storybook-debug": "node --inspect-brk node_modules/@storybook/react/bin -p 9999",
8183
"stylelint": "stylelint --ignore-path .stylelintignore '**/*.css'",
84+
"stylelint-ci": "stylelint --ignore-path .stylelintignore --custom-formatter 'scripts/jslint-xml.js' '**/*.css' | xmlappend eslint-report.xml",
8285
"test": "vitest src",
8386
"type-check": "(npm run type-check:create-d-ts && npm run type-check:main && npm run type-check:build) ; npm run type-check:cleanup-d-ts",
8487
"type-check:create-d-ts": "npx tcm src && npx tcm .storybook",
8588
"type-check:main": "tsc --noEmit -p tsconfig.json",
8689
"type-check:build": "tsc --noEmit -p tsconfig-build.json",
8790
"type-check:cleanup-d-ts": "rimraf src/**/*.css.d.ts .storybook/*.css.d.ts .storybook/**/*.css.d.ts",
91+
"type-check-ci": "node scripts/tsc-teamcity",
8892
"update-styles": "node scripts/update-styles.mjs",
8993
"validate-tc-config": "mvn --file .teamcity/pom.xml org.jetbrains.teamcity:teamcity-configs-maven-plugin:generate -e"
9094
},
@@ -140,6 +144,7 @@
140144
"dotenv-cli": "^11.0.0",
141145
"eslint": "^10.0.1",
142146
"eslint-config-prettier": "^10.1.8",
147+
"eslint-formatter-jslint-xml": "^8.40.0",
143148
"eslint-import-resolver-exports": "^1.0.0-beta.5",
144149
"eslint-import-resolver-typescript": "^4.4.4",
145150
"eslint-import-resolver-webpack": "^0.13.10",

scripts/jslint-xml.js

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
const xmlEscape = s =>
2+
// eslint-disable-next-line no-control-regex
3+
`${s}`.replace(/[<>&"'\x00-\x1F\x7F\u0080-\uFFFF]/g, c => {
4+
switch (c) {
5+
case '<':
6+
return '&lt;';
7+
case '>':
8+
return '&gt;';
9+
case '&':
10+
return '&amp;';
11+
case '"':
12+
return '&quot;';
13+
case "'":
14+
return '&apos;';
15+
default:
16+
return `&#${c.charCodeAt(0)};`;
17+
}
18+
});
19+
20+
module.exports = results => {
21+
const files = results.map(file => {
22+
const warnings = file.warnings.map(({column, line, text}) => {
23+
// eslint-disable-next-line no-underscore-dangle
24+
const css = file._postcssResult && file._postcssResult.css;
25+
const lines = (css && css.split('\n')) || [];
26+
const evidence = lines[line - 1];
27+
28+
return [
29+
`<issue line="${line}"`,
30+
` char="${column}"`,
31+
` evidence="${evidence ? xmlEscape(evidence) : ''}"`,
32+
` reason="${xmlEscape(text)}" />`,
33+
].join('');
34+
});
35+
36+
return `<file name="${file.source}">${warnings.join('')}</file>`;
37+
});
38+
39+
return `<?xml version="1.0" encoding="utf-8"?><jslint>${files.join('')}</jslint>`;
40+
};

0 commit comments

Comments
 (0)