From b205621511cda0e01e6c010f1516e56cf40bf4db Mon Sep 17 00:00:00 2001 From: Owen Buckley Date: Fri, 3 May 2024 13:23:02 -0400 Subject: [PATCH] chore/issue 24 formatting and linting (#40) --- .github/ISSUE_TEMPLATE.md | 2 +- .github/PULL_REQUEST_TEMPLATE.md | 2 +- .github/workflows/ci.yml | 44 +- .husky/.gitignore | 1 + .husky/pre-commit | 4 + .ls-lint.yml | 24 + .nvmrc | 2 +- .prettierrc | 3 + .storybook/main.js | 8 +- .storybook/preview.js | 6 +- CONTRIBUTING.md | 18 +- eslint.config.js | 246 ++ greenwood.config.js | 4 +- package-lock.json | 3026 ++++++++++++++++++++++- package.json | 20 + src/components/footer/footer.js | 6 +- src/components/footer/footer.spec.js | 21 +- src/components/footer/footer.stories.js | 8 +- src/pages/index.html | 10 +- src/stories/Configure.mdx | 33 +- src/stories/Documentation.mdx | 2 +- src/stories/Styleguide.mdx | 11 +- src/stories/Techstack.mdx | 6 +- src/styles/main.css | 2 +- src/styles/theme.css | 22 +- stylelint.config.js | 6 + web-test-runner.config.js | 23 +- 27 files changed, 3396 insertions(+), 164 deletions(-) create mode 100644 .husky/.gitignore create mode 100755 .husky/pre-commit create mode 100644 .ls-lint.yml create mode 100644 .prettierrc create mode 100644 eslint.config.js create mode 100644 stylelint.config.js diff --git a/.github/ISSUE_TEMPLATE.md b/.github/ISSUE_TEMPLATE.md index 871d15c0..a00c6c71 100644 --- a/.github/ISSUE_TEMPLATE.md +++ b/.github/ISSUE_TEMPLATE.md @@ -4,4 +4,4 @@ ## Details - \ No newline at end of file + diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index 6892708b..f61ea0e0 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -14,4 +14,4 @@ We love contributions and appreciate any help you can offer! 1. [x] Thing I fixed 1. [x] Other thing I updated 1. [x] Docs I updated ---> \ No newline at end of file +--> diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4d2ecb50..6a4723b5 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -3,7 +3,6 @@ name: Continuous Integration on: [pull_request] jobs: - build: runs-on: ubuntu-20.04 @@ -12,23 +11,26 @@ jobs: node: [18] steps: - - uses: actions/checkout@v4 - - name: Use Node.js ${{ matrix.node }} - uses: actions/setup-node@v4 - with: - node-version: ${{ matrix.node }} - - name: Installing project dependencies - run: | - npm ci - # - name: Lint - # run: | - # npm run lint - - name: Test - run: | - npm run test - - name: Build Storybook - run: | - npm run story:build - - name: Build Project - run: | - npm run build \ No newline at end of file + - uses: actions/checkout@v4 + - name: Use Node.js ${{ matrix.node }} + uses: actions/setup-node@v4 + with: + node-version: ${{ matrix.node }} + - name: Installing project dependencies + run: | + npm ci + - name: Format + run: | + npm run format:check + - name: Lint + run: | + npm run lint + - name: Test + run: | + npm run test + - name: Build Storybook + run: | + npm run story:build + - name: Build Project + run: | + npm run build diff --git a/.husky/.gitignore b/.husky/.gitignore new file mode 100644 index 00000000..31354ec1 --- /dev/null +++ b/.husky/.gitignore @@ -0,0 +1 @@ +_ diff --git a/.husky/pre-commit b/.husky/pre-commit new file mode 100755 index 00000000..36af2198 --- /dev/null +++ b/.husky/pre-commit @@ -0,0 +1,4 @@ +#!/bin/sh +. "$(dirname "$0")/_/husky.sh" + +npx lint-staged diff --git a/.ls-lint.yml b/.ls-lint.yml new file mode 100644 index 00000000..236960db --- /dev/null +++ b/.ls-lint.yml @@ -0,0 +1,24 @@ +ls: + .config.js: kebabcase + .spec.js: kebabcase + .stories.js: kebabcase + .js: kebabcase + .json: kebabcase + .css: kebabcase + .html: kebabcase + .ico: kebabcase + .jpg: kebabcase + .png: kebabcase + .webp: kebabcase + .svg: kebabcase + .tff: kebabcase + .woff: kebabcase + .woff2: kebabcase + +ignore: + - .git + - .greenwood + - node_modules + - public + - reports + - storybook-static diff --git a/.nvmrc b/.nvmrc index 1e24c021..67a228a4 100644 --- a/.nvmrc +++ b/.nvmrc @@ -1 +1 @@ -18.15.0 \ No newline at end of file +18.18.0 \ No newline at end of file diff --git a/.prettierrc b/.prettierrc new file mode 100644 index 00000000..de753c53 --- /dev/null +++ b/.prettierrc @@ -0,0 +1,3 @@ +{ + "printWidth": 100 +} diff --git a/.storybook/main.js b/.storybook/main.js index 174963a5..9e1c07d7 100644 --- a/.storybook/main.js +++ b/.storybook/main.js @@ -1,11 +1,7 @@ /** @type { import('@storybook/web-components-vite').StorybookConfig } */ const config = { stories: ["../src/**/*.mdx", "../src/**/*.stories.@(js|jsx|mjs|ts|tsx)"], - addons: [ - "@storybook/addon-links", - "@storybook/addon-essentials", - "@chromatic-com/storybook", - ], + addons: ["@storybook/addon-links", "@storybook/addon-essentials", "@chromatic-com/storybook"], framework: { name: "@storybook/web-components-vite", options: {}, @@ -15,4 +11,4 @@ const config = { }, }; -export default config; \ No newline at end of file +export default config; diff --git a/.storybook/preview.js b/.storybook/preview.js index 2dd7f02c..d424860d 100644 --- a/.storybook/preview.js +++ b/.storybook/preview.js @@ -1,5 +1,5 @@ -import '../src/styles/theme.css'; -import '../src/styles/main.css'; +import "../src/styles/theme.css"; +import "../src/styles/main.css"; /** @type { import('@storybook/web-components').Preview } */ const preview = { @@ -13,4 +13,4 @@ const preview = { }, }; -export default preview; \ No newline at end of file +export default preview; diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 532681ef..210e8d55 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,6 +1,6 @@ # Contributing -Thanks for contributing to the GreenwoodJS website! This document aims to help guide contributions into this project. +Thanks for contributing to the GreenwoodJS website! This document aims to help guide contributions into this project. ## Project Structure @@ -12,14 +12,14 @@ The layout of the project is as follows: - _/stories/_ - General developer documentation about the project for developers - _/styles/_ - Global theme and styles -> [!NOTE] +> [!NOTE] > _Please review the documentation contained in this project's Storybook by running `npm run story:dev` and going through the content in the **Overview** section_ ## Documentation Changes ### Greenwood Features -Documentation changes specific to an in progress / unreleased feature in Greenwood should be made to the corresponding feature branch in this repository aligning with that Greenwood release. This can be determined at the time of submitting your PR to Greenwood in coordination with the maintainers. +Documentation changes specific to an in progress / unreleased feature in Greenwood should be made to the corresponding feature branch in this repository aligning with that Greenwood release. This can be determined at the time of submitting your PR to Greenwood in coordination with the maintainers. For example, if the next release your feature is targeting for Greenwood is 1.1.0, the git workflow would be as follows: @@ -31,10 +31,9 @@ $ git checkout -b content/issue-xxx-the-feature Where `issue-xxx` is the corresponding issue in the GreenwoodJS project. - ### Website -General changes to the website can be made by submitting a PR directly to the main branch. This includes typos, style changes, and general enhancements to the website as a whole. +General changes to the website can be made by submitting a PR directly to the main branch. This includes typos, style changes, and general enhancements to the website as a whole. ## Development @@ -42,7 +41,7 @@ General changes to the website can be made by submitting a PR directly to the ma All global theming and general styles should go in _src/styles/theme.css_, like font family and CSS custom properties to be used throughout the site. -[Open Props](https://open-props.style/) are used in this project to provide a set of consistent and re-usable design system tokens. Please review these first before creating any new custom values or variables. +[Open Props](https://open-props.style/) are used in this project to provide a set of consistent and re-usable design system tokens. Please review these first before creating any new custom values or variables. ### Components @@ -63,7 +62,7 @@ export default class MyComponent extends HTMLElement { - - + +

Welcome to Greenwood!

- - \ No newline at end of file + diff --git a/src/stories/Configure.mdx b/src/stories/Configure.mdx index fc40e820..32fe631d 100644 --- a/src/stories/Configure.mdx +++ b/src/stories/Configure.mdx @@ -15,21 +15,23 @@ import Accessibility from "./assets/accessibility.png"; import Theming from "./assets/theming.png"; import AddonLibrary from "./assets/addon-library.png"; -export const RightArrow = () => ( + - - + > + + +); @@ -38,6 +40,7 @@ export const RightArrow = () =>
@@ -84,6 +87,7 @@ export const RightArrow = () =>
@@ -203,6 +207,7 @@ export const RightArrow = () => Discover tutorials
+