Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 37 additions & 4 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
version: 2
version: 2.1

jobs:
build:
docker:
- image: circleci/node:10
- image: circleci/node

steps:
- checkout
Expand All @@ -11,13 +12,45 @@ jobs:
keys:
- v1-dependencies-{{ checksum "yarn.lock" }}
- v1-dependencies-
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is this cache key used for?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We make CircleCI cache the NPM dependencies between builds so we don't have to redownload them.
Based on your other comments, I will rework the CI config.


- run: yarn install --frozen-lock

- save_cache:
paths:
- node_modules
key: v1-dependencies-{{ checksum "yarn.lock" }}

- run: yarn format:check
- run: yarn lint
- run: yarn test
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just to confirm, from the compatibility perspective, we're more interested in the test results because yarn lint just lints the source in this repo?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, you are right.


test_eslint:
docker:
- image: circleci/node

parameters:
eslint:
type: string

steps:
- checkout

- restore_cache:
keys:
- v1-dependencies-{{ checksum "yarn.lock" }}
- v1-dependencies-

- run: yarn format -- --list-different
- run: yarn install --frozen-lock
- run: yarn add --dev eslint@<< parameters.eslint >>
- run: yarn test

workflows:
build_and_test:
jobs:
- build
- test_eslint:
requires:
- build
matrix:
parameters:
eslint: ["6", "7"]
17 changes: 9 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,25 +12,26 @@
],
"scripts": {
"format": "prettier --write \"**/*.{js,md}\"",
"format:check": "prettier --check \"**/*.{js,md}\"",
"lint": "eslint",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"lint": "eslint",
"lint": "eslint .",

Seems like eslint@6 just prints the help options when you don't specify a path:
https://app.circleci.com/pipelines/github/salesforce/eslint-config-lwc/75/workflows/10ee9089-33c8-4f5e-9336-975ba1157ead/jobs/75

But eslint@7 is fine without it:
https://app.circleci.com/pipelines/github/salesforce/eslint-config-lwc/75/workflows/10ee9089-33c8-4f5e-9336-975ba1157ead/jobs/76

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch @ekashida. I think we need to run yarn lint first and then install a different eslint version to run the tests.

"test": "mocha"
},
"dependencies": {
"@lwc/eslint-plugin-lwc": "~0.10.0",
"babel-eslint": "~10.1.0",
"eslint-plugin-import": "~2.20.2",
"eslint-plugin-import": "~2.22.1",
"eslint-plugin-jest": "~23.8.2",
"eslint-restricted-globals": "~0.2.0"
},
"devDependencies": {
"eslint": "^6.8.0",
"husky": "^4.2.5",
"lint-staged": "^10.1.6",
"mocha": "^7.1.1",
"prettier": "^2.0.4"
"eslint": "^7.13.0",
"husky": "^4.3.0",
"lint-staged": "^10.5.1",
"mocha": "^8.2.1",
"prettier": "^2.1.2"
},
"peerDependencies": {
"eslint": "^6.0.0"
"eslint": "^6 || ^7"
},
"repository": {
"type": "git",
Expand All @@ -48,7 +49,7 @@
],
"husky": {
"hooks": {
"pre-commit": "lint-staged && yarn format"
"pre-commit": "lint-staged"
}
},
"lint-staged": {
Expand Down
Loading