Skip to content

Commit

Permalink
ci: run client linters on changed files (#33701)
Browse files Browse the repository at this point in the history
  • Loading branch information
valerybugakov committed Apr 14, 2022
1 parent c31661b commit 868472f
Show file tree
Hide file tree
Showing 35 changed files with 119 additions and 75 deletions.
2 changes: 1 addition & 1 deletion .vscode/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
{
"label": "stylelint",
"command": "yarn",
"args": ["-s", "run", "all:stylelint", "--", "--formatter", "compact"],
"args": ["-s", "run", "lint:css:all", "--", "--formatter", "compact"],
"problemMatcher": {
"owner": "stylelint",
"applyTo": "closedDocuments",
Expand Down
4 changes: 2 additions & 2 deletions client/branded/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
"license": "Apache-2.0",
"scripts": {
"storybook": "STORIES_GLOB=client/branded/src/**/*.story.tsx yarn workspace @sourcegraph/storybook run start",
"eslint": "eslint --cache '**/*.[jt]s?(x)'",
"stylelint": "stylelint 'src/**/*.scss' --quiet",
"lint:js": "eslint --cache '**/*.[jt]s?(x)'",
"lint:css": "stylelint 'src/**/*.scss' --quiet",
"test": "jest"
}
}
4 changes: 2 additions & 2 deletions client/browser/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@
"release:firefox": "./scripts/release-firefox.sh",
"release:npm": "TS_NODE_COMPILER_OPTIONS=\"{\\\"module\\\":\\\"commonjs\\\"}\" ts-node ./scripts/publish-npm.ts",
"lint": "yarn run eslint && yarn run stylelint",
"eslint": "eslint --cache '**/*.[jt]s?(x)'",
"stylelint": "stylelint 'src/**/*.scss'",
"lint:js": "eslint --cache '**/*.[jt]s?(x)'",
"lint:css": "stylelint 'src/**/*.scss'",
"clean": "rm -rf build/ dist/ *.zip *.xpi .checksum",
"test": "jest --testPathIgnorePatterns end-to-end integration",
"test-e2e": "mocha './src/end-to-end/**/*.test.ts'",
Expand Down
2 changes: 1 addition & 1 deletion client/build-config/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"sideEffects": false,
"license": "Apache-2.0",
"scripts": {
"eslint": "eslint --cache 'src/**/*.[jt]s?(x)'",
"lint:js": "eslint --cache 'src/**/*.[jt]s?(x)'",
"test": "jest"
}
}
2 changes: 1 addition & 1 deletion client/client-api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"sideEffects": false,
"license": "Apache-2.0",
"scripts": {
"eslint": "eslint --cache 'src/**/*.[jt]s?(x)'",
"lint:js": "eslint --cache 'src/**/*.[jt]s?(x)'",
"test": "jest"
}
}
4 changes: 2 additions & 2 deletions client/codeintellify/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"sideEffects": false,
"license": "Apache-2.0",
"scripts": {
"eslint": "eslint --cache 'src/**/*.[jt]s?(x)'",
"lint:js": "eslint --cache 'src/**/*.[jt]s?(x)'",
"test": "jest"
}
}
}
1 change: 1 addition & 0 deletions client/codeintellify/src/testutils/github/styles.css
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* stylelint-disable */
.github-testase * {
box-sizing: border-box;
}
Expand Down
1 change: 1 addition & 0 deletions client/codeintellify/src/testutils/sourcegraph/styles.css
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* stylelint-disable */
.sourcegraph-testcase * {
box-sizing: border-box;
}
Expand Down
2 changes: 1 addition & 1 deletion client/common/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"sideEffects": false,
"license": "Apache-2.0",
"scripts": {
"eslint": "eslint --cache 'src/**/*.[jt]s?(x)'",
"lint:js": "eslint --cache 'src/**/*.[jt]s?(x)'",
"test": "jest"
}
}
2 changes: 1 addition & 1 deletion client/eslint-plugin-sourcegraph/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
],
"main": "lib/index.js",
"scripts": {
"eslint": "echo 'TODO: add proper ESLint config, issue #19448'",
"lint:js": "echo 'TODO: add proper ESLint config, issue #19448'",
"test": "mocha tests --recursive"
},
"dependencies": {
Expand Down
2 changes: 1 addition & 1 deletion client/extension-api-types/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
],
"sideEffects": false,
"scripts": {
"eslint": "eslint 'src/**/*.[jt]s?(x)'",
"lint:js": "eslint 'src/**/*.[jt]s?(x)'",
"prepublishOnly": "yarn run eslint"
},
"peerDependencies": {
Expand Down
2 changes: 1 addition & 1 deletion client/extension-api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
],
"sideEffects": false,
"scripts": {
"eslint": "eslint 'src/*.[jt]s?(x)'",
"lint:js": "eslint 'src/*.[jt]s?(x)'",
"docs": "typedoc",
"prepublishOnly": "yarn run eslint && yarn run docs"
},
Expand Down
2 changes: 1 addition & 1 deletion client/http-client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"sideEffects": false,
"license": "Apache-2.0",
"scripts": {
"eslint": "eslint --cache 'src/**/*.[jt]s?(x)'",
"lint:js": "eslint --cache 'src/**/*.[jt]s?(x)'",
"test": "jest"
}
}
2 changes: 1 addition & 1 deletion client/search-ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"license": "Apache-2.0",
"scripts": {
"storybook": "STORIES_GLOB=client/search-ui/src/**/*.story.tsx yarn workspace @sourcegraph/storybook run start",
"eslint": "eslint --cache 'src/**/*.[jt]s?(x)'",
"lint:js": "eslint --cache 'src/**/*.[jt]s?(x)'",
"test": "jest"
}
}
3 changes: 3 additions & 0 deletions client/search-ui/src/input/CodeMirrorQueryInput.module.scss
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// This rule is disable to preserve 1-1 mapping between `DecoratedToken` types and classes.
/* stylelint-disable selector-class-pattern */
.root {
flex: 1;
min-width: 0;
Expand Down Expand Up @@ -46,6 +48,7 @@
code {
background-color: rgba(220, 220, 220, 0.4);
border-radius: var(--border-radius);
/* stylelint-disable-next-line declaration-property-unit-allowed-list */
padding: 0 0.4em;
}

Expand Down
2 changes: 1 addition & 1 deletion client/search-ui/src/input/CodeMirrorQueryInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -375,7 +375,7 @@ const tokenDecorators: { [key: string]: Decoration } = Object.fromEntries(
const emptyDecorator = Decoration.mark({})
const focusedFilterDeco = Decoration.mark({ class: styles.focusedFilter })

// Chooses the correct decorator for the decorated token. Copied (and adapated)
// Chooses the correct decorator for the decorated token. Copied (and adapted)
// from decoratedToMonaco (decoratedToken.ts).
const decoratedToDecoration = (token: DecoratedToken): Decoration => {
let cssClass = 'identifier'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@

// Border should appear directly under the width of the icon
// Halfway past the icon, minus half the border size
/* stylelint-disable scss/operator-no-newline-after */
margin-left: calc(
var(--icon-inline-size) / 2 - var(--streaming-skipped-item-message-border-size) / 2 +
var(--streaming-skipped-item-button-margin)
Expand All @@ -39,6 +40,7 @@
var(--icon-inline-size) / 2 - var(--streaming-skipped-item-message-border-size) / 2 +
var(--streaming-skipped-item-button-margin)
);
/* stylelint-enable scss/operator-no-newline-after */

margin-right: var(--streaming-skipped-item-button-margin);
}
Expand Down
2 changes: 1 addition & 1 deletion client/search/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"sideEffects": false,
"license": "Apache-2.0",
"scripts": {
"eslint": "eslint --cache 'src/**/*.[jt]s?(x)'",
"lint:js": "eslint --cache 'src/**/*.[jt]s?(x)'",
"test": "jest"
}
}
4 changes: 2 additions & 2 deletions client/shared/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
"license": "Apache-2.0",
"scripts": {
"storybook": "STORIES_GLOB=client/shared/src/**/*.story.tsx yarn workspace @sourcegraph/storybook run start",
"eslint": "eslint --cache '**/*.[jt]s?(x)'",
"stylelint": "stylelint 'src/**/*.scss' --quiet",
"lint:js": "eslint --cache '**/*.[jt]s?(x)'",
"lint:css": "stylelint 'src/**/*.scss' --quiet",
"test": "jest",
"graphql": "gulp graphQlSchema",
"schema": "gulp schema",
Expand Down
2 changes: 1 addition & 1 deletion client/storybook/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"license": "Apache-2.0",
"main": "./src/index.ts",
"scripts": {
"eslint": "eslint --cache 'src/**/*.[jt]s?(x)'",
"lint:js": "eslint --cache 'src/**/*.[jt]s?(x)'",
"start": "TS_NODE_TRANSPILE_ONLY=true start-storybook -p 9001 -c ./src -s ./assets,../../ui/assets",
"build": "TS_NODE_TRANSPILE_ONLY=true build-storybook -c ./src -s ./assets,../../ui/assets",
"build:webpack-stats": "TS_NODE_TRANSPILE_ONLY=true WEBPACK_DLL_PLUGIN=false start-storybook -c ./src -s ./assets --smoke-test --webpack-stats-json ./storybook-static --loglevel warn",
Expand Down
2 changes: 1 addition & 1 deletion client/template-parser/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"sideEffects": false,
"license": "Apache-2.0",
"scripts": {
"eslint": "eslint --cache 'src/**/*.[jt]s?(x)'",
"lint:js": "eslint --cache 'src/**/*.[jt]s?(x)'",
"test": "jest"
}
}
11 changes: 11 additions & 0 deletions client/vscode/.stylelintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"extends": ["../../.stylelintrc.json"],
"overrides": [
{
"files": ["./src/webview/index.scss"],
"rules": {
"filenames/match-regex": null
}
}
]
}
2 changes: 1 addition & 1 deletion client/vscode/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@
}
},
"scripts": {
"eslint": "eslint --cache '**/*.[jt]s?(x)'",
"lint:js": "eslint --cache '**/*.[jt]s?(x)'",
"test": "ts-node ./tests/runTests.ts",
"package": "ts-node ./scripts/package.ts",
"task:gulp": "cross-env NODE_OPTIONS=\"--max_old_space_size=8192\" gulp",
Expand Down
4 changes: 2 additions & 2 deletions client/web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@
"watch-webpack": "yarn task:gulp watchWebpack",
"webpack": "yarn task:gulp webpack",
"lint": "yarn run eslint && gulp unusedExports && yarn run stylelint",
"eslint": "NODE_OPTIONS=\"--max_old_space_size=16192\" eslint --cache '**/*.[tj]s?(x)'",
"stylelint": "stylelint 'src/**/*.scss' --quiet",
"lint:js": "NODE_OPTIONS=\"--max_old_space_size=16192\" eslint --cache '**/*.[tj]s?(x)'",
"lint:css": "stylelint 'src/**/*.scss' --quiet",
"browserslist": "browserslist",
"analyze-bundle": "WEBPACK_USE_NAMED_CHUNKS=true NODE_ENV=production ENTERPRISE=1 WEBPACK_ANALYZER=1 yarn build",
"bundlesize": "bundlesize --config=./bundlesize.config.js"
Expand Down
4 changes: 2 additions & 2 deletions client/wildcard/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
"license": "Apache-2.0",
"scripts": {
"storybook": "STORIES_GLOB=client/wildcard/src/**/*.story.tsx yarn workspace @sourcegraph/storybook run start",
"eslint": "eslint --cache '**/*.[jt]s?(x)'",
"stylelint": "stylelint 'src/**/*.scss' --quiet",
"lint:js": "eslint --cache '**/*.[jt]s?(x)'",
"lint:css": "stylelint 'src/**/*.scss' --quiet",
"test": "jest"
}
}
2 changes: 1 addition & 1 deletion dev/ci/yarn-web-integration.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ echo "--- Yarn install in root"
yarn --mutex network --frozen-lockfile --network-timeout 60000

echo "--- Run integration test suite"
yarn percy exec yarn cover-integration:base "$@"
yarn percy exec yarn _cover-integration "$@"

echo "--- Process NYC report"
yarn nyc report -r json
Expand Down
1 change: 0 additions & 1 deletion dev/foreach-ts-project.sh
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ DIRS=(
client/storybook
client/client-api
dev/release
dev/ts-morph
)

run_command() {
Expand Down
4 changes: 2 additions & 2 deletions dev/release/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
"description": "Scripts for managing release captain duties",
"private": true,
"scripts": {
"release": "../../node_modules/.bin/ts-node --transpile-only ./src/main.ts",
"eslint": "../../node_modules/.bin/eslint 'src/**/*.ts'"
"release": "ts-node --transpile-only ./src/main.ts",
"lint:js": "eslint --cache 'src/**/*.[jt]s?(x)'"
},
"dependencies": {}
}
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* stylelint-disable */
@import url('https://fonts.googleapis.com/css2?family=Source+Code+Pro:wght@400;600&display=swap');

@media (prefers-color-scheme: dark) {
Expand Down

0 comments on commit 868472f

Please sign in to comment.