From caa0ada414d73e6351e741bbec431c63db6fa683 Mon Sep 17 00:00:00 2001 From: Mathew May Date: Fri, 5 Dec 2025 14:25:59 +0800 Subject: [PATCH 1/5] docs: Add Code of Conduct to the project --- .github/CODE_OF_CONDUCT.md | 128 +++++++++++++++++++++++++++++++++++++ 1 file changed, 128 insertions(+) create mode 100644 .github/CODE_OF_CONDUCT.md diff --git a/.github/CODE_OF_CONDUCT.md b/.github/CODE_OF_CONDUCT.md new file mode 100644 index 0000000..bf364e6 --- /dev/null +++ b/.github/CODE_OF_CONDUCT.md @@ -0,0 +1,128 @@ +# Contributor Covenant Code of Conduct + +## Our Pledge + +We as members, contributors, and leaders pledge to make participation in our +community a harassment-free experience for everyone, regardless of age, body +size, visible or invisible disability, ethnicity, sex characteristics, gender +identity and expression, level of experience, education, socio-economic status, +nationality, personal appearance, race, religion, or sexual identity +and orientation. + +We pledge to act and interact in ways that contribute to an open, welcoming, +diverse, inclusive, and healthy community. + +## Our Standards + +Examples of behavior that contributes to a positive environment for our +community include: + +- Demonstrating empathy and kindness toward other people +- Being respectful of differing opinions, viewpoints, and experiences +- Giving and gracefully accepting constructive feedback +- Accepting responsibility and apologizing to those affected by our mistakes, + and learning from the experience +- Focusing on what is best not just for us as individuals, but for the + overall community + +Examples of unacceptable behavior include: + +- The use of sexualized language or imagery, and sexual attention or + advances of any kind +- Trolling, insulting or derogatory comments, and personal or political attacks +- Public or private harassment +- Publishing others' private information, such as a physical or email + address, without their explicit permission +- Other conduct which could reasonably be considered inappropriate in a + professional setting + +## Enforcement Responsibilities + +Community leaders are responsible for clarifying and enforcing our standards of +acceptable behavior and will take appropriate and fair corrective action in +response to any behavior that they deem inappropriate, threatening, offensive, +or harmful. + +Community leaders have the right and responsibility to remove, edit, or reject +comments, commits, code, wiki edits, issues, and other contributions that are +not aligned to this Code of Conduct, and will communicate reasons for moderation +decisions when appropriate. + +## Scope + +This Code of Conduct applies within all community spaces, and also applies when +an individual is officially representing the community in public spaces. +Examples of representing our community include using an official e-mail address, +posting via an official social media account, or acting as an appointed +representative at an online or offline event. + +## Enforcement + +Instances of abusive, harassing, or otherwise unacceptable behavior may be +reported to the community leaders responsible for enforcement at +[MDS project on Moodle Tracker](https://tracker.moodle.org/browse/MDS). +All complaints will be reviewed and investigated promptly and fairly. + +All community leaders are obligated to respect the privacy and security of the +reporter of any incident. + +## Enforcement Guidelines + +Community leaders will follow these Community Impact Guidelines in determining +the consequences for any action they deem in violation of this Code of Conduct: + +### 1. Correction + +**Community Impact**: Use of inappropriate language or other behavior deemed +unprofessional or unwelcome in the community. + +**Consequence**: A private, written warning from community leaders, providing +clarity around the nature of the violation and an explanation of why the +behavior was inappropriate. A public apology may be requested. + +### 2. Warning + +**Community Impact**: A violation through a single incident or series +of actions. + +**Consequence**: A warning with consequences for continued behavior. No +interaction with the people involved, including unsolicited interaction with +those enforcing the Code of Conduct, for a specified period of time. This +includes avoiding interactions in community spaces as well as external channels +like social media. Violating these terms may lead to a temporary or +permanent ban. + +### 3. Temporary Ban + +**Community Impact**: A serious violation of community standards, including +sustained inappropriate behavior. + +**Consequence**: A temporary ban from any sort of interaction or public +communication with the community for a specified period of time. No public or +private interaction with the people involved, including unsolicited interaction +with those enforcing the Code of Conduct, is allowed during this period. +Violating these terms may lead to a permanent ban. + +### 4. Permanent Ban + +**Community Impact**: Demonstrating a pattern of violation of community +standards, including sustained inappropriate behavior, harassment of an +individual, or aggression toward or disparagement of classes of individuals. + +**Consequence**: A permanent ban from any sort of public interaction within +the community. + +## Attribution + +This Code of Conduct is adapted from the [Contributor Covenant][homepage], +version 2.0, available at +https://www.contributor-covenant.org/version/2/0/code_of_conduct.html. + +Community Impact Guidelines were inspired by [Mozilla's code of conduct +enforcement ladder](https://github.com/mozilla/diversity). + +[homepage]: https://www.contributor-covenant.org + +For answers to common questions about this code of conduct, see the FAQ at +https://www.contributor-covenant.org/faq. Translations are available at +https://www.contributor-covenant.org/translations. From 87bc9a764df6df9f9f334bd4ae6b8cd92797a33d Mon Sep 17 00:00:00 2001 From: Mathew May Date: Fri, 5 Dec 2025 14:57:15 +0800 Subject: [PATCH 2/5] feat: Add GitHub pull request template for better reviews --- .github/PULL_REQUEST_TEMPLATE.md | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 .github/PULL_REQUEST_TEMPLATE.md diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md new file mode 100644 index 0000000..e59e981 --- /dev/null +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -0,0 +1,30 @@ +## Description + + + +## Related Jira or GitHub Issue + + + +## Type of Change + +- [ ] Feature +- [ ] Bugfix +- [ ] Refactor +- [ ] Documentation +- [ ] Other (please describe) + +## Screenshots/Previews + + + +## Checklist + +- [ ] I have updated, added, and run tests such as JSUnit, Storybook interactions, or fuzzing to prove my fix is effective or that my feature works +- [ ] I have updated or added Storybook stories for new or changed components (if appropriate) +- [ ] I have considered accessibility and described any improvements or issues +- [ ] I have considered security implications and referenced [SECURITY.md](./SECURITY.md) if relevant + +## Additional Notes + + From f5e535eb0d874f7ec4444a4f2a80debe4f8b53ee Mon Sep 17 00:00:00 2001 From: Mathew May Date: Fri, 5 Dec 2025 14:27:45 +0800 Subject: [PATCH 3/5] docs: Centralize community insight files out of project root --- CODEOWNERS => .github/CODEOWNERS | 0 CONTRIBUTING.md => .github/CONTRIBUTING.md | 0 SECURITY.md => .github/SECURITY.md | 0 3 files changed, 0 insertions(+), 0 deletions(-) rename CODEOWNERS => .github/CODEOWNERS (100%) rename CONTRIBUTING.md => .github/CONTRIBUTING.md (100%) rename SECURITY.md => .github/SECURITY.md (100%) diff --git a/CODEOWNERS b/.github/CODEOWNERS similarity index 100% rename from CODEOWNERS rename to .github/CODEOWNERS diff --git a/CONTRIBUTING.md b/.github/CONTRIBUTING.md similarity index 100% rename from CONTRIBUTING.md rename to .github/CONTRIBUTING.md diff --git a/SECURITY.md b/.github/SECURITY.md similarity index 100% rename from SECURITY.md rename to .github/SECURITY.md From 74a139f37763610c5f5d18cc0ba10749f9913e82 Mon Sep 17 00:00:00 2001 From: Mathew May Date: Fri, 5 Dec 2025 17:11:39 +0800 Subject: [PATCH 4/5] refactor(Release-Please): Centralize associated files --- .../release-please/.release-please-manifest.json | 0 .../release-please/release-please-config.json | 0 .github/workflows/release-tooling.yml | 3 ++- 3 files changed, 2 insertions(+), 1 deletion(-) rename .release-please-manifest.json => .github/release-please/.release-please-manifest.json (100%) rename release-please-config.json => .github/release-please/release-please-config.json (100%) diff --git a/.release-please-manifest.json b/.github/release-please/.release-please-manifest.json similarity index 100% rename from .release-please-manifest.json rename to .github/release-please/.release-please-manifest.json diff --git a/release-please-config.json b/.github/release-please/release-please-config.json similarity index 100% rename from release-please-config.json rename to .github/release-please/release-please-config.json diff --git a/.github/workflows/release-tooling.yml b/.github/workflows/release-tooling.yml index 91cad1e..e66e9fc 100644 --- a/.github/workflows/release-tooling.yml +++ b/.github/workflows/release-tooling.yml @@ -21,8 +21,9 @@ jobs: steps: - uses: googleapis/release-please-action@v4 with: + config-file: .github/release-please/release-please-config.json + manifest-file: .github/release-please/.release-please-manifest.json token: ${{ secrets.RELEASE_PLEASE_TOKEN }} - release-type: node deploy-storybook: permissions: From d02b626c7af8310b1308a875d5f55c3a1a701d69 Mon Sep 17 00:00:00 2001 From: Mathew May Date: Fri, 5 Dec 2025 17:18:53 +0800 Subject: [PATCH 5/5] refactor(Lint): Centralize lint files --- .editorconfig | 2 +- .../linters/.commitlintrc.ts | 0 .github/linters/.prettierignore | 5 ++ .prettierrc => .github/linters/.prettierrc | 0 .github/linters/eslint.config.mjs | 68 +++++++++++++++++++ .github/workflows/commitlint.yml | 2 +- .husky/commit-msg | 3 +- .prettierignore | 3 - .vscode/settings.json | 4 +- eslint.config.mjs | 65 ------------------ package.json | 10 +-- 11 files changed, 85 insertions(+), 77 deletions(-) rename .commitlintrc.ts => .github/linters/.commitlintrc.ts (100%) create mode 100644 .github/linters/.prettierignore rename .prettierrc => .github/linters/.prettierrc (100%) create mode 100644 .github/linters/eslint.config.mjs delete mode 100644 .prettierignore delete mode 100644 eslint.config.mjs diff --git a/.editorconfig b/.editorconfig index a1f2859..a9b879e 100644 --- a/.editorconfig +++ b/.editorconfig @@ -29,7 +29,7 @@ trim_trailing_whitespace = true # UTF-8 encoding charset = utf-8 -# Use spaces for all indents with a width of 4 characters. +# Use spaces for all indents with a width of 2 characters. indent_style = space indent_size = 2 diff --git a/.commitlintrc.ts b/.github/linters/.commitlintrc.ts similarity index 100% rename from .commitlintrc.ts rename to .github/linters/.commitlintrc.ts diff --git a/.github/linters/.prettierignore b/.github/linters/.prettierignore new file mode 100644 index 0000000..c27d2b5 --- /dev/null +++ b/.github/linters/.prettierignore @@ -0,0 +1,5 @@ +coverage/ +dist/ +storybook-static/ +tokens/ +CHANGELOG.md diff --git a/.prettierrc b/.github/linters/.prettierrc similarity index 100% rename from .prettierrc rename to .github/linters/.prettierrc diff --git a/.github/linters/eslint.config.mjs b/.github/linters/eslint.config.mjs new file mode 100644 index 0000000..b1b2fef --- /dev/null +++ b/.github/linters/eslint.config.mjs @@ -0,0 +1,68 @@ +import { fixupConfigRules, fixupPluginRules } from '@eslint/compat'; +import { FlatCompat } from '@eslint/eslintrc'; +import js from '@eslint/js'; +import typescriptEslint from '@typescript-eslint/eslint-plugin'; +import tsParser from '@typescript-eslint/parser'; +import { defineConfig, globalIgnores } from 'eslint/config'; +import globals from 'globals'; +import path from 'node:path'; +import { fileURLToPath } from 'node:url'; + +const __filename = fileURLToPath(import.meta.url); +const __dirname = path.dirname(__filename); +const compat = new FlatCompat({ + baseDirectory: __dirname, + recommendedConfig: js.configs.recommended, + allConfig: js.configs.all, +}); + +export default defineConfig( + [globalIgnores(['storybook-static/', 'dist/', 'coverage/'])], + [ + { + extends: fixupConfigRules( + compat.extends( + 'eslint:recommended', + 'plugin:react/recommended', + 'plugin:@typescript-eslint/recommended', + 'plugin:@typescript-eslint/eslint-recommended', + 'prettier', + 'plugin:prettier/recommended', + 'plugin:react-hooks/recommended', + 'plugin:storybook/recommended', + ), + ), + + settings: { + react: { + version: 'detect', + }, + }, + + plugins: { + '@typescript-eslint': fixupPluginRules(typescriptEslint), + }, + + languageOptions: { + globals: { + ...globals.jest, + ...globals.browser, + }, + + parser: tsParser, + }, + + ignores: [ + 'eslint.config.mjs', + 'vitest.config.js', + '**/vendor/*.js', + 'CHANGELOG.md', + ], + + rules: { + 'react/react-in-jsx-scope': 'off', + 'react/prop-types': 'off', + }, + }, + ], +); diff --git a/.github/workflows/commitlint.yml b/.github/workflows/commitlint.yml index 617cad9..e0f4fff 100644 --- a/.github/workflows/commitlint.yml +++ b/.github/workflows/commitlint.yml @@ -27,4 +27,4 @@ jobs: - name: Validate PR commits with commitlint if: github.event_name == 'pull_request' - run: npx commitlint -g .commitlintrc.ts --from ${{ github.event.pull_request.base.sha }} --to ${{ github.event.pull_request.head.sha }} --verbose + run: npx commitlint -g .github/linters/.commitlintrc.ts --from ${{ github.event.pull_request.base.sha }} --to ${{ github.event.pull_request.head.sha }} --verbose diff --git a/.husky/commit-msg b/.husky/commit-msg index 8f0548f..d7c9d06 100644 --- a/.husky/commit-msg +++ b/.husky/commit-msg @@ -1 +1,2 @@ -npx commitlint -e $1 -g .commitlintrc.ts +npx commitlint -e $1 -g .github/linters/.commitlintrc.ts + diff --git a/.prettierignore b/.prettierignore deleted file mode 100644 index 1158e1c..0000000 --- a/.prettierignore +++ /dev/null @@ -1,3 +0,0 @@ -tokens/css/* -tokens/dtcg/* -CHANGELOG.md diff --git a/.vscode/settings.json b/.vscode/settings.json index b0705ee..a72e68b 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -8,5 +8,7 @@ "javascript", "javascriptreact" ], - "eslint.workingDirectories": [{ "mode": "auto" }] + "eslint.workingDirectories": [{ "mode": "auto" }], + "prettier.configPath": ".github/linters/.prettierrc", + "prettier.ignorePath": ".github/linters/.prettierignore" } diff --git a/eslint.config.mjs b/eslint.config.mjs deleted file mode 100644 index 5e720f2..0000000 --- a/eslint.config.mjs +++ /dev/null @@ -1,65 +0,0 @@ -import { fixupConfigRules, fixupPluginRules } from '@eslint/compat'; -import { FlatCompat } from '@eslint/eslintrc'; -import js from '@eslint/js'; -import typescriptEslint from '@typescript-eslint/eslint-plugin'; -import tsParser from '@typescript-eslint/parser'; -import { defineConfig } from 'eslint/config'; -import globals from 'globals'; -import path from 'node:path'; -import { fileURLToPath } from 'node:url'; - -const __filename = fileURLToPath(import.meta.url); -const __dirname = path.dirname(__filename); -const compat = new FlatCompat({ - baseDirectory: __dirname, - recommendedConfig: js.configs.recommended, - allConfig: js.configs.all, -}); - -export default defineConfig([ - { - extends: fixupConfigRules( - compat.extends( - 'eslint:recommended', - 'plugin:react/recommended', - 'plugin:@typescript-eslint/recommended', - 'plugin:@typescript-eslint/eslint-recommended', - 'prettier', - 'plugin:prettier/recommended', - 'plugin:react-hooks/recommended', - 'plugin:storybook/recommended', - ), - ), - - settings: { - react: { - version: 'detect', - }, - }, - - plugins: { - '@typescript-eslint': fixupPluginRules(typescriptEslint), - }, - - languageOptions: { - globals: { - ...globals.jest, - ...globals.browser, - }, - - parser: tsParser, - }, - - ignores: [ - 'eslint.config.mjs', - 'vitest.config.js', - '**/vendor/*.js', - 'CHANGELOG.md', - ], - - rules: { - 'react/react-in-jsx-scope': 'off', - 'react/prop-types': 'off', - }, - }, -]); diff --git a/package.json b/package.json index caf54e8..62b5d7b 100644 --- a/package.json +++ b/package.json @@ -78,14 +78,14 @@ "build": "tsc && vite build", "build-storybook": "storybook build", "build-tokens": "tsx scripts/tokens.ts", - "format": "prettier --write . '**/*.{ts,tsx,js,jsx,yml}'", - "lint": "eslint . --ext .ts,.tsx,.js,.jsx --fix", + "format": "prettier --config .github/linters/.prettierrc --ignore-path .github/linters/.prettierignore --write . '**/*.{ts,tsx,js,jsx,yml}'", + "lint": "eslint . --ext .ts,.tsx,.js,.jsx --fix --config .github/linters/eslint.config.mjs", "prepare": "husky" }, "lint-staged": { - "*.{js,jsx,ts,tsx}": [ - "prettier --write", - "eslint --fix" + "*{js,jsx,ts,tsx}": [ + "prettier --config .github/linters/.prettierrc --ignore-path .github/linters/.prettierignore --write", + "eslint --fix --config .github/linters/eslint.config.mjs" ] }, "repository": {