-
-
Notifications
You must be signed in to change notification settings - Fork 28
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
This is a fake PR to test GH actions #2421
Changes from all commits
2a5a91e
0531eb0
9825dc8
56b68b1
30df4b9
30cdf67
0019f3a
a6b56dc
c5dc684
cf9a012
cc5efec
bd438cd
cf0a002
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 | ||||
---|---|---|---|---|---|---|
@@ -0,0 +1,6 @@ | ||||||
| Test | Result | Local Command | Description | | ||||||
|:--------------:|:--------------:|-------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | ||||||
| **Formatting** | {{ .formatting_out_md }} | `npm run format` | Automatically standardizes formatting, checks for syntax errors | | ||||||
| **Linting** | {{ .linting_out_md }} | `npm run lint` | Checks JS files for code quality, style issues, and JSdoc comments using [ESLint](https://eslint.org/). Generally follows the [Airbnb style guide](https://github.com/airbnb/javascript) | | ||||||
| **Unit Tests** | {{ .unit_out_md }} | `npm test` | Runs unit tests to ensure that the code changes do not break existing functionality. | | ||||||
| **JSDoc** | {{ .jsdoc_out_md }} | `npm run jsdoc-dry-run` | Ensures that building the docs website succeeds and that there are no JSDoc warnings. |s | ||||||
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. [prettier] reported by reviewdog 🐶
Suggested change
|
Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
@@ -0,0 +1,12 @@ | ||||||||||||||||||||||||||||||||||
**Hi! Thanks for contributing to MetacatUI :tada:** | ||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||
As we strive to improve our code quality, we've implemented automated checks to help ensure all contributions meet the set of standards outlined in the [contributing guidelines](https://github.com/NCEAS/metacatui/blob/main/CONTRIBUTING.md). All of the checks have passed! :white_check_mark: Here's a summary of the checks that were performed: | ||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||
- **Formatting**: {{ .formatting_out_md }} | ||||||||||||||||||||||||||||||||||
- Checks for standardized indenting, spacing, line breaks, etc. using [prettier](https://prettier.io/) | ||||||||||||||||||||||||||||||||||
- **Linting**: {{ .linting_out_md }} | ||||||||||||||||||||||||||||||||||
- Checks JS files for code quality, style issues, and JSdoc comments using [ESLint](https://eslint.org/). Generally follows the [Airbnb style guide](https://github.com/airbnb/javascript) | ||||||||||||||||||||||||||||||||||
- **Unit Tests**: {{ .unit_out_md }} | ||||||||||||||||||||||||||||||||||
- Runs unit tests to ensure that the code changes do not break existing functionality. If you have added new functionality, please add tests to cover it. | ||||||||||||||||||||||||||||||||||
- **JSDoc**: {{ .jsdoc_out_md }} | ||||||||||||||||||||||||||||||||||
- Ensures that building the docs website succeeds and that there are no JSDoc warnings. | ||||||||||||||||||||||||||||||||||
Comment on lines
+5
to
+12
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. [prettier] reported by reviewdog 🐶
Suggested change
|
Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
@@ -0,0 +1,34 @@ | ||||||||||||||||||||||||||||||||||
**Hi! Thanks for contributing to MetacatUI :tada:** | ||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||
As we strive to improve our code quality, we've implemented automated checks to help ensure all contributions meet the set of standards outlined in the [contributing guidelines](https://github.com/NCEAS/metacatui/blob/main/CONTRIBUTING.md). These checks show that there may be some issues related to the changes you've submitted. Not to worry! These are typically easy to fix and we're here to help you through the process. | ||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||
### What checks were performed? | ||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||
Here is a summary of the checks that were performed and the issues that were found: | ||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||
- **Formatting**: {{ .formatting_out_md }} | ||||||||||||||||||||||||||||||||||
- Checks for standardized indenting, spacing, line breaks, etc. using [prettier](https://prettier.io/) | ||||||||||||||||||||||||||||||||||
- **Linting**: {{ .linting_out_md }} | ||||||||||||||||||||||||||||||||||
- Checks JS files for code quality, style issues, and JSdoc comments using [ESLint](https://eslint.org/). Generally follows the [Airbnb style guide](https://github.com/airbnb/javascript) | ||||||||||||||||||||||||||||||||||
- **Unit Tests**: {{ .unit_out_md }} | ||||||||||||||||||||||||||||||||||
- Runs unit tests to ensure that the code changes do not break existing functionality. If you have added new functionality, please add tests to cover it. | ||||||||||||||||||||||||||||||||||
- **JSDoc**: {{ .jsdoc_out_md }} | ||||||||||||||||||||||||||||||||||
- Ensures that building the docs website succeeds and that there are no JSDoc warnings. | ||||||||||||||||||||||||||||||||||
Comment on lines
+9
to
+16
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. [prettier] reported by reviewdog 🐶
Suggested change
|
||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||
### What are the next steps? | ||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||
The github actions bot will add some comments below detailing any issues related to formatting or linting. If possible, the bot will include suggested fixes that you may be able to apply directly to your code. Errors with unit tests or the JS docs build can be reviewed on the [actions page](https://github.com/NCEAS/metacatui/actions). | ||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||
To see errors on your local machine, run `npm install` and then: | ||||||||||||||||||||||||||||||||||
- Run `npm run format` to automatically fix formatting issues | ||||||||||||||||||||||||||||||||||
- Run `npm run lint` to see linting issues | ||||||||||||||||||||||||||||||||||
- Run `npm test` to run unit tests and see any failures | ||||||||||||||||||||||||||||||||||
- Run `npm run jsdoc-dry-run` to see JSDoc warnings | ||||||||||||||||||||||||||||||||||
Comment on lines
+23
to
+26
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. [prettier] reported by reviewdog 🐶
Suggested change
|
||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||
Review the warning and error messages, make the necessary updates to your code, and push the changes to your branch. The bot will re-run the checks and add new comments to this PR. | ||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||
### Still running into issues? | ||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||
If you're stuck or need help, don't hesitate to ask! Tag a maintainer in the comments or reach out on [slack](https://slack.dataone.org/). | ||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||
We appreciate your effort to help us improve MetacatUI!! | ||||||||||||||||||||||||||||||||||
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. [prettier] reported by reviewdog 🐶
Suggested change
|
Original file line number | Diff line number | Diff line change | ||||||||
---|---|---|---|---|---|---|---|---|---|---|
@@ -0,0 +1,57 @@ | ||||||||||
name: Format, Lint, & Test | ||||||||||
|
||||||||||
on: | ||||||||||
pull_request: | ||||||||||
types: [opened, reopened, synchronize] | ||||||||||
branches-ignore: | ||||||||||
- "ignore-*" | ||||||||||
|
||||||||||
jobs: | ||||||||||
run_checks: | ||||||||||
name: Run All Checks | ||||||||||
runs-on: ubuntu-latest | ||||||||||
permissions: | ||||||||||
contents: read | ||||||||||
pull-requests: write | ||||||||||
steps: | ||||||||||
- name: Check out code | ||||||||||
uses: actions/checkout@v3 | ||||||||||
with: | ||||||||||
fetch-depth: 0 # Fetch all history for diff | ||||||||||
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. [prettier] reported by reviewdog 🐶
Suggested change
|
||||||||||
|
||||||||||
- name: Set up Node.js | ||||||||||
uses: actions/setup-node@v3 | ||||||||||
with: | ||||||||||
node-version: '18' | ||||||||||
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. [prettier] reported by reviewdog 🐶
Suggested change
|
||||||||||
|
||||||||||
- name: Install dependencies | ||||||||||
run: npm install | ||||||||||
|
||||||||||
- name: Check for linting errors on changed code | ||||||||||
uses: reviewdog/action-eslint@v1 | ||||||||||
if: always() | ||||||||||
with: | ||||||||||
github_token: ${{ secrets.GITHUB_TOKEN }} | ||||||||||
reporter: github-pr-review | ||||||||||
eslint_flags: 'src' | ||||||||||
filter_mode: 'diff_context' | ||||||||||
Comment on lines
+36
to
+37
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. [prettier] reported by reviewdog 🐶
Suggested change
|
||||||||||
fail_on_error: true | ||||||||||
|
||||||||||
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. [prettier] reported by reviewdog 🐶
Suggested change
|
||||||||||
- name: Check for formatting errors on changed code | ||||||||||
uses: EPMatt/reviewdog-action-prettier@v1 | ||||||||||
if: always() | ||||||||||
with: | ||||||||||
github_token: ${{ secrets.GITHUB_TOKEN }} | ||||||||||
reporter: github-pr-review | ||||||||||
filter_mode: 'diff_context' | ||||||||||
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. [prettier] reported by reviewdog 🐶
Suggested change
|
||||||||||
fail_on_error: true | ||||||||||
|
||||||||||
- name: Ensure unit tests pass | ||||||||||
id: test | ||||||||||
if: always() | ||||||||||
run: npm test | ||||||||||
|
||||||||||
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. [prettier] reported by reviewdog 🐶
Suggested change
|
||||||||||
- name: Ensure docs build without errors | ||||||||||
id: jsdoc-dry-run | ||||||||||
if: always() | ||||||||||
run: npm run jsdoc-dry-run |
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,114 @@ | ||
import { FlatCompat } from "@eslint/eslintrc"; | ||
import pluginJs from "@eslint/js"; | ||
import path from "path"; | ||
import { fileURLToPath } from "url"; | ||
import globals from "globals"; | ||
import prettierConfig from "eslint-config-prettier"; | ||
import requirejs from "eslint-plugin-requirejs"; | ||
import jsdoc from "eslint-plugin-jsdoc"; | ||
|
||
// For compatibility with configs that don't use the new eslint flat config format: | ||
const __filename = fileURLToPath(import.meta.url); | ||
const __dirname = path.dirname(__filename); | ||
const compat = new FlatCompat({ | ||
baseDirectory: __dirname, | ||
}); | ||
|
||
// --------------------------------------------------------------------- | ||
// ESLINT RECOMMENDED: | ||
// Use the recommended config for JS files by eslint | ||
const eslintRecommendedConfig = pluginJs.configs.recommended; | ||
const eslintRulesOverrides = { | ||
// Allow underscored names to explicitly indicate an argument is not used | ||
"no-unused-vars": ["error", { argsIgnorePattern: "^_" }], | ||
}; | ||
|
||
// --------------------------------------------------------------------- | ||
// AIRBNB JAVASCRIPT STYLE GUIDE: | ||
// Use the Airbnb style guide, excluding react- and node- specific rules & the | ||
// rule that disallows "use strict" | ||
const airbnbConfigs = [ | ||
...compat.extends("eslint-config-airbnb-base/rules/best-practices"), | ||
...compat.extends("eslint-config-airbnb-base/rules/errors"), | ||
...compat.extends("eslint-config-airbnb-base/rules/style"), | ||
...compat.extends("eslint-config-airbnb-base/rules/variables"), | ||
...compat.extends("eslint-config-airbnb-base/rules/es6"), | ||
...compat.extends("eslint-config-airbnb-base/rules/imports"), | ||
]; | ||
const airbnbRulesOverrides = { | ||
// We are using the AMD/RequireJS module pattern | ||
"import/no-amd": "off", | ||
"import/no-commonjs": "off", | ||
}; | ||
|
||
// --------------------------------------------------------------------- | ||
// JSDOCS: | ||
// Ensure JSDoc comments are used, and check validity | ||
const jsdocConfig = jsdoc.configs["flat/recommended"]; | ||
const jsdocsRulesOverrides = { | ||
// Non-standard JSDoc tags we use to generate documentation. | ||
"jsdoc/check-tag-names": [ | ||
"error", | ||
{ definedTags: ["classcategory", "screenshot"] }, | ||
], | ||
// Avoiding this error would mean importing modules we don't use | ||
"jsdoc/no-undefined-types": "off", | ||
}; | ||
|
||
// --------------------------------------------------------------------- | ||
// REQUIREJS | ||
// Use all rules from the recommended config for RequireJS | ||
const requirejsConfig = { | ||
name: "requirejs", | ||
plugins: { | ||
requirejs, | ||
}, | ||
rules: { | ||
...requirejs.configs.recommended.rules, | ||
}, | ||
}; | ||
|
||
// --------------------------------------------------------------------- | ||
// METACATUI OVERRIDES | ||
const metacatuiConfig = { | ||
files: ["src/**/*.js"], | ||
languageOptions: { | ||
sourceType: "commonjs", | ||
ecmaVersion: 2020, | ||
globals: { | ||
...globals.browser, | ||
...globals.amd, | ||
MetacatUI: "readonly", | ||
google: "readonly", | ||
}, | ||
}, | ||
// Override rules that are not compatible with MetacatUI | ||
rules: { | ||
...eslintRulesOverrides, | ||
...airbnbRulesOverrides, | ||
...jsdocsRulesOverrides, | ||
}, | ||
}; | ||
|
||
// Ignores must be a separate object to be treated as global | ||
const ignoreList = { | ||
ignores: [ | ||
"src/components/", | ||
"docs/", | ||
"test/", | ||
"node_modules/", | ||
".github", | ||
"server.js", | ||
"eslint.config.mjs", | ||
], | ||
}; | ||
|
||
export default [ | ||
ignoreList, | ||
eslintRecommendedConfig, | ||
...airbnbConfigs, | ||
jsdocConfig, | ||
requirejsConfig, | ||
metacatuiConfig, | ||
prettierConfig, // prettier must be the last config in the array | ||
]; |
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.
[prettier] reported by reviewdog 🐶