-
Notifications
You must be signed in to change notification settings - Fork 77
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
build: make sure eslint-plugin-calcite-components is set up correctly #7294
Changes from 3 commits
228792f
2250c6f
35d67bc
a1faf63
13a6570
b249208
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,11 +2,11 @@ | |
|
||
Esri welcomes contributions from anyone and everyone. Please see our [guidelines for contributing](https://github.com/esri/contributing). | ||
|
||
Note: New contributors should first contact [Ben Elan](mailto:[email protected]) or [Juan Carlos Franco](mailto:[email protected]) to join the [Calcite Components GitHub team](https://github.com/orgs/Esri/teams/calcite-components/members). Then, clone the repo via SSH key on your machine (this Git workflow is required in order to work with our Chromatic test integration). | ||
Note: New contributors should first contact [Ben Elan](mailto:[email protected]) or [Juan Carlos Franco](mailto:[email protected]) to join the [Calcite Contributors GitHub team](https://github.com/orgs/Esri/teams/calcite-contributors/members). Then, clone the repo via SSH key on your machine (this Git workflow is required in order to work with our Chromatic test integration). | ||
|
||
## I want to contribute, what should I work on? | ||
|
||
Calcite Components is still in its early stages. You can help most by: | ||
You can help most by: | ||
|
||
- Adding ideas for components by [creating a New Component issue](https://github.com/Esri/calcite-design-system/issues/new?assignees=&labels=new+component%2C0+-+new%2Cneeds+triage&template=new-component.yml). | ||
- Requesting features for existing components by [creating a Enhancement issue](https://github.com/Esri/calcite-design-system/issues/new?assignees=&labels=enhancement%2C0+-+new%2Cneeds+triage&template=enhancement.yml). | ||
|
@@ -112,11 +112,11 @@ If your IDE supports the [Language Server Protocol (LSP) specification](https:// | |
|
||
## Starting the demos | ||
|
||
First, clone the repo and install the NPM dependencies from within the `calcite-components` directory: | ||
First, clone the repo, install the NPM dependencies: | ||
|
||
```sh | ||
git clone [email protected]:Esri/calcite-design-system.git | ||
cd calcite-components | ||
cd calcite-design-system | ||
npm install | ||
``` | ||
|
||
|
@@ -126,23 +126,38 @@ Next, start the local Stencil development server on localhost: | |
npm start | ||
``` | ||
|
||
The demos will open in the browser after building. Edit the pages in [`src/demos`](./src/demos) to modify the component demos, such as changing attributes or adding content to slots. When adding a new demo page, make sure to add a link in [`index.html`](./src/index.html) so others can find it. You can also edit the component code in [`src/components`](./src/components), and the changes will be reflected in the demos. | ||
The demos will open in the browser after building. Edit the pages in [`packages/calcite-components/src/demos`](.packages/calcite-components/src/demos) to modify the component demos, such as changing attributes or adding content to slots. When adding a new demo page, make sure to add a link in [`packages/calcite-components/src/index.html`](./packages/calcite-components/src/index.html) so others can find it. You can also edit the component code in [`packages/calcite-components/src/components`](packages/calcite-components/src/components`./src/components), and the changes will be reflected in the demos. | ||
|
||
## Linting | ||
|
||
This project uses [lint-staged](https://www.npmjs.com/package/lint-staged) to automatically format code on commit, making it easier to contribute. There are also NPM scripts in [`package.json`](./package.json) to lint a variety of filetypes. To run them all: | ||
This project uses [lint-staged](https://www.npmjs.com/package/lint-staged) to automatically format code on commit, making it easier to contribute. Each package has it's own linting NPM scripts, so check there for more options. For example, calcite-components has NPM scripts that lint by different filetypes. To run the lint command for all packages, do: | ||
|
||
```sh | ||
npm run lint | ||
``` | ||
|
||
Or use the `--workspace` flag to lint a single package. | ||
|
||
```sh | ||
npm --workspace=packages/calcite-components run lint | ||
``` | ||
|
||
You can avoid using the `--workspace` flag in every command by `cd`ing into the package you're working on: | ||
|
||
```sh | ||
cd packages/calcite-components | ||
# the following will lint and test calcite-components only | ||
npm run lint | ||
npm test | ||
``` | ||
|
||
## Running the tests | ||
|
||
`npm test` will run the current test suite. | ||
`npm test` will run the test suites. | ||
|
||
Calcite Components include Stencil's default testing tools which are built on [Jest](https://jestjs.io/) and [Puppeteer](https://github.com/GoogleChrome/puppeteer). | ||
|
||
If you're working on writing tests for a particular component, it can be helpful to use `npm run test:watch` to retest on file changes. Once the initial tests run, typing `o` at the prompt will run tests only on changed files, allowing you to quickly iterate on tests for a specific component. | ||
If you're working on writing tests for a particular component, it can be helpful to use `npm --workspace=packages/calcite-components run test:watch` to retest on file changes. Once the initial tests run, typing `o` at the prompt will run tests only on changed files, allowing you to quickly iterate on tests for a specific component. You can also add a pattern to the end of the command to match for a test's file path. | ||
|
||
Please refer to the [Stencil testing documentation](https://stenciljs.com/docs/testing-overview) and Calcite's [testing conventions](./conventions/Testing.md) for more information. | ||
|
||
|
@@ -156,9 +171,9 @@ Stencil creates API reference documentation using JSDoc, here is their [document | |
|
||
1. Create a new file inside your component directory like `X.stories.js` | ||
2. Write stories | ||
3. Run the documentation locally with `npm run docs:preview` | ||
3. Run the documentation locally with `npm --workspace=packages/calcite-components run docs:preview` | ||
|
||
The `docs:preview` command will build Calcite Components and open your browser to view the storybook docs locally. | ||
Calcite Component's `docs:preview` command will build and open your browser to view the storybook docs locally. | ||
|
||
Please refer to the [Documentation Conventions](./conventions/Documentation.md) for more information. | ||
|
||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
__docs-temp__/* | ||
docs/ | ||
hydrate/ | ||
src/**/*.js | ||
*.js | ||
src/components/icon/assets | ||
www/ |
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"ignorePatterns": ["*"] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Any package with this configuration will skip linting entirely, right? If so, won't this make the contributing instructions on linting misleading? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. For now, maybe the contributing doc can be updated to indicate that ESLint will only run on There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah I added this to CCR and the eslint plugin so eslint won't complain about there not being a config which covers their files. I'm working on pulling shared eslint/tsconfigs into separate workspaces as part of the lint-staged fix. After that happens, the base eslint config will be used in these packages. So I'm going to leave the doc as is for now so I don't have to change it and then change it back. |
||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nitpick: I feel like we need an
"and then"
between cloning and installing deps. I'll leave this up to you.