Skip to content
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

Closed
Closed
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
6 changes: 6 additions & 0 deletions .github/WORKFLOW_TEMPLATE/format-test-lint-summary.md
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) |
Comment on lines +1 to +4
Copy link
Contributor

Choose a reason for hiding this comment

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

[prettier] reported by reviewdog 🐶

Suggested change
| 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) |
| 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
Copy link
Contributor

Choose a reason for hiding this comment

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

[prettier] reported by reviewdog 🐶

Suggested change
| **JSDoc** | {{ .jsdoc_out_md }} | `npm run jsdoc-dry-run` | Ensures that building the docs website succeeds and that there are no JSDoc warnings. |s
| **JSDoc** | {{ .jsdoc_out_md }} | `npm run jsdoc-dry-run` | Ensures that building the docs website succeeds and that there are no JSDoc warnings. | s |

12 changes: 12 additions & 0 deletions .github/WORKFLOW_TEMPLATE/pr-comment-confirmation.md
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
Copy link
Contributor

Choose a reason for hiding this comment

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

[prettier] reported by reviewdog 🐶

Suggested change
- **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.
- **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.

34 changes: 34 additions & 0 deletions .github/WORKFLOW_TEMPLATE/pr-comment-guidance.md
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
Copy link
Contributor

Choose a reason for hiding this comment

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

[prettier] reported by reviewdog 🐶

Suggested change
- **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.
- **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.


### 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
Copy link
Contributor

Choose a reason for hiding this comment

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

[prettier] reported by reviewdog 🐶

Suggested change
- 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
- 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


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!!
Copy link
Contributor

Choose a reason for hiding this comment

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

[prettier] reported by reviewdog 🐶

Suggested change
We appreciate your effort to help us improve MetacatUI!!
We appreciate your effort to help us improve MetacatUI!!

57 changes: 57 additions & 0 deletions .github/workflows/format-lint-test.yml
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
Copy link
Contributor

Choose a reason for hiding this comment

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

[prettier] reported by reviewdog 🐶

Suggested change
fetch-depth: 0 # Fetch all history for diff
fetch-depth: 0 # Fetch all history for diff


- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: '18'
Copy link
Contributor

Choose a reason for hiding this comment

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

[prettier] reported by reviewdog 🐶

Suggested change
node-version: '18'
node-version: "18"


- 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
Copy link
Contributor

Choose a reason for hiding this comment

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

[prettier] reported by reviewdog 🐶

Suggested change
eslint_flags: 'src'
filter_mode: 'diff_context'
eslint_flags: "src"
filter_mode: "diff_context"

fail_on_error: true

Copy link
Contributor

Choose a reason for hiding this comment

The 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'
Copy link
Contributor

Choose a reason for hiding this comment

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

[prettier] reported by reviewdog 🐶

Suggested change
filter_mode: 'diff_context'
filter_mode: "diff_context"

fail_on_error: true

- name: Ensure unit tests pass
id: test
if: always()
run: npm test

Copy link
Contributor

Choose a reason for hiding this comment

The 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
35 changes: 0 additions & 35 deletions .github/workflows/test.js.yml

This file was deleted.

114 changes: 114 additions & 0 deletions eslint.config.mjs
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
];
Loading
Loading