Commit 7e856294 authored by Jose Ivan Vargas's avatar Jose Ivan Vargas

Merge branch 'ps-update-eslint-job-not-to-hardcode-dir' into 'master'

Update lint:eslint to not hardcode "."

See merge request gitlab-org/gitlab!55425
parents 7f422613 b3c78a03
......@@ -56,7 +56,7 @@ The current Lefthook configuration can be found in [`lefthook.yml`](https://gitl
Before you push your changes, Lefthook automatically runs the following checks:
- Danger: Runs a subset of checks that `danger-review` runs on your merge requests.
- ES lint: Run `yarn run internal:eslint` checks (with the [`.eslintrc.yml`](https://gitlab.com/gitlab-org/gitlab/-/blob/master/.eslintrc.yml) configuration) on the modified `*.{js,vue}` files. Tags: `frontend`, `style`.
- ES lint: Run `yarn run lint:eslint` checks (with the [`.eslintrc.yml`](https://gitlab.com/gitlab-org/gitlab/-/blob/master/.eslintrc.yml) configuration) on the modified `*.{js,vue}` files. Tags: `frontend`, `style`.
- HAML lint: Run `bundle exec haml-lint` checks (with the [`.haml-lint.yml`](https://gitlab.com/gitlab-org/gitlab/-/blob/master/.haml-lint.yml) configuration) on the modified `*.html.haml` files. Tags: `view`, `haml`, `style`.
- Markdown lint: Run `yarn markdownlint` checks on the modified `*.md` files. Tags: `documentation`, `style`.
- SCSS lint: Run `yarn lint:stylelint` checks (with the [`.stylelintrc`](https://gitlab.com/gitlab-org/gitlab/-/blob/master/.stylelintrc) configuration) on the modified `*.scss{,.css}` files. Tags: `stylesheet`, `css`, `style`.
......
......@@ -14,7 +14,7 @@ In addition to the style guidelines set by Airbnb, we also have a few specific r
listed below.
NOTE:
You can run ESLint locally by running `yarn run lint:eslint`
You can run ESLint locally by running `yarn run lint:eslint:all` or `yarn run lint:eslint $PATH_TO_FILE`.
## Avoid forEach
......
......@@ -30,10 +30,16 @@ yarn run lint:eslint:staged:fix
If manual changes are required, a list of changes are sent to the console.
To check a specific file in the repository with ESLINT, run the following script (replacing $PATH_TO_FILE):
```shell
yarn run lint:eslint $PATH_TO_FILE
```
To check **all** files in the repository with ESLint, run the following script:
```shell
yarn run lint:eslint
yarn run lint:eslint:all
```
A list of problems found are logged to the console.
......@@ -41,7 +47,7 @@ A list of problems found are logged to the console.
To apply automatic ESLint fixes to **all** files in the repository, run the following script:
```shell
yarn run lint:eslint:fix
yarn run lint:eslint:all:fix
```
If manual changes are required, a list of changes are sent to the console.
......
......@@ -7,7 +7,7 @@ pre-push:
tags: frontend style
files: git diff --name-only $(git merge-base origin/master HEAD)..HEAD
glob: "*.{js,vue}"
run: yarn run internal:eslint {files}
run: yarn run lint:eslint {files}
haml-lint:
tags: view haml style
files: git diff --name-only $(git merge-base origin/master HEAD)..HEAD
......
......@@ -3,7 +3,7 @@
unless Rails.env.production?
desc "GitLab | Run ESLint"
task eslint: ['yarn:check'] do
unless system('yarn run lint:eslint')
unless system('yarn run lint:eslint:all')
abort('rake eslint failed')
end
end
......
......@@ -5,7 +5,7 @@
"block-dependencies": "node scripts/frontend/block_dependencies.js",
"clean": "rm -rf public/assets tmp/cache/*-loader",
"dev-server": "NODE_OPTIONS=\"--max-old-space-size=3584\" node scripts/frontend/webpack_dev_server.js",
"eslint-fix": "echo 'Please use `yarn lint:eslint:fix` instead' && exit 1",
"eslint-fix": "echo 'Please use `yarn lint:eslint:all:fix` instead' && exit 1",
"eslint-staged": "echo 'Please use `yarn lint:eslint:staged` instead' && exit 1",
"eslint-staged-fix": "echo 'Please use `yarn lint:eslint:staged:fix` instead' && exit 1",
"eslint-report": "echo 'Please use `yarn lint:eslint:report` instead' && exit 1",
......@@ -21,8 +21,10 @@
"karma": "BABEL_ENV=${BABEL_ENV:=karma} karma start --single-run true config/karma.config.js",
"karma-coverage": "BABEL_ENV=coverage karma start --single-run true config/karma.config.js",
"karma-start": "BABEL_ENV=karma karma start config/karma.config.js",
"lint:eslint": "yarn run internal:eslint .",
"lint:eslint:fix": "yarn run lint:eslint --fix",
"lint:eslint": "yarn run internal:eslint",
"lint:eslint:fix": "yarn run internal:eslint --fix",
"lint:eslint:all": "yarn run internal:eslint .",
"lint:eslint:all:fix": "yarn run lint:eslint:all --fix",
"lint:eslint:report": "yarn run internal:eslint --format html --output-file ./eslint-report.html --no-inline-config .",
"lint:eslint:staged": "scripts/frontend/execute-on-staged-files.sh internal:eslint '(js|vue)'",
"lint:eslint:staged:fix": "yarn run lint:eslint:staged --fix",
......
......@@ -25,7 +25,7 @@ class StaticAnalysis
# Most of the time, RuboCop finishes in 30 seconds, but sometimes it can take around 1200 seconds so we set a
# duration of 300 to lower the likelihood that it will run in the same job as another long task...
%w[bundle exec rubocop --parallel] => 300,
%w[yarn run lint:eslint] => 197,
%w[yarn run lint:eslint:all] => 197,
%w[yarn run lint:prettier] => 124,
%w[bin/rake gettext:lint] => 96,
%w[bundle exec license_finder] => 49,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment