Skip to content

Commit

Permalink
Merge pull request #66 from mParticle/feat/automated-formatting-and-l…
Browse files Browse the repository at this point in the history
…inting

style: Automated formatting and linting [PR #4 - Linting and Formatting]
  • Loading branch information
tibuurcio committed Jan 25, 2024
2 parents 4cbd194 + f8d243e commit 4cf6c21
Show file tree
Hide file tree
Showing 162 changed files with 7,906 additions and 5,130 deletions.
105 changes: 105 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
module.exports = {
env: {
browser: true,
es2024: true,
},
settings: {
react: {
version: 'detect',
},
},
extends: ['standard-with-typescript', 'eslint:recommended', 'plugin:react/recommended', 'prettier'],
parserOptions: {
ecmaVersion: 'latest',
sourceType: 'module',
extraFileExtensions: ['.md', '.css'],
},
plugins: ['react', 'react-hooks'],
ignorePatterns: ['.eslintrc.js'],
rules: {
'@typescript-eslint/explicit-function-return-type': [
'warn',
{
allowedNames: [
'Button',
'FloatButton',
'Icon',
'Rate',
'Form',
'TreeSelect',
'Select',
'Mentions',
'Radio',
'ColorPicker',
'Slider',
'Cascader',
'DatePicker',
'Checkbox',
'Input',
'InputNumber',
'Switch',
'Upload',
'AutoComplete',
'TimePicker',
'Transfer',
'Collapse',
'Timeline',
'Calendar',
'Segmented',
'Tabs',
'Tag',
'Tour',
'Carousel',
'Tooltip',
'Statistic',
'Tree',
'Image',
'QRCode',
'Badge',
'Card',
'Avatar',
'Descriptions',
'Table',
'Empty',
'Popover',
'List',
'Progress',
'Result',
'Spin',
'Skeleton',
'Watermark',
'Popconfirm',
'Drawer',
'Modal',
'Notification',
'Alert',
'Message',
'LoadingModal',
'Flex',
'Space',
'Layout',
'Grid',
'Divider',
'Steps',
'Anchor',
'Dropdown',
'Breadcrumb',
'Pagination',
'Menu',
'ConfigProvider',
'Affix',
'App',
],
},
],
'@typescript-eslint/strict-boolean-expressions': 'off',
'@typescript-eslint/consistent-type-definitions': 'off',
'@typescript-eslint/no-use-before-define': ['error', { allowNamedExports: true }],
'react/react-in-jsx-scope': 'off',
'import/no-duplicates': 'off',
},
globals: {
React: true,
expect: true,
},
}
12 changes: 6 additions & 6 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ version: 2
updates:
- commit-message:
prefix: 'chore'
directory: "/"
directory: '/'
labels: ['dependabot']
open-pull-requests-limit: 5
package-ecosystem: "npm"
package-ecosystem: 'npm'
schedule:
interval: "weekly"
day: "monday"
time: "15:00"
target-branch: 'chore/dependabot'
interval: 'weekly'
day: 'monday'
time: '15:00'
target-branch: 'chore/dependabot'
2 changes: 1 addition & 1 deletion .github/workflows/chromatic.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@ jobs:
- name: Publish to Chromatic
uses: chromaui/action@latest
with:
projectToken: ${{ secrets.CHROMATIC_PROJECT_TOKEN }}
projectToken: ${{ secrets.CHROMATIC_PROJECT_TOKEN }}
6 changes: 3 additions & 3 deletions .github/workflows/dependabot-automerge.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
name: "Dependabot Automerge"
name: 'Dependabot Automerge'

on: workflow_dispatch

jobs:
automerge-dependabot:
name: "Automerge Dependabot PR"
uses: mParticle/mparticle-workflows/.github/workflows/dependabot-automerge.yml@stable
name: 'Automerge Dependabot PR'
uses: mParticle/mparticle-workflows/.github/workflows/dependabot-automerge.yml@stable
6 changes: 3 additions & 3 deletions .github/workflows/dependabot-branch-rebase.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: "Dependabot Branch Rebase"
name: 'Dependabot Branch Rebase'

on:
push:
Expand All @@ -8,6 +8,6 @@ on:

jobs:
rebase-branch:
name: "Rebase Development onto Dependabot Branch"
name: 'Rebase Development onto Dependabot Branch'
uses: mParticle/mparticle-workflows/.github/workflows/dependabot-rebase-main.yml@stable
secrets: inherit
secrets: inherit
108 changes: 53 additions & 55 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,60 +1,58 @@
name: Release Aquarium

on:
workflow_dispatch:
workflow_dispatch:

jobs:
# release is done from main branch.
confirm-public-repo-main-branch:
name: 'Confirm release is run from public/main branch'
uses: mParticle/mparticle-workflows/.github/workflows/sdk-release-repo-branch-check.yml@main

release:
name: Perform Release
runs-on: ubuntu-latest
needs: confirm-public-repo-main-branch

env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GIT_AUTHOR_NAME: mparticle-automation
GIT_AUTHOR_EMAIL: developers@mparticle.com
GIT_COMMITTER_NAME: mparticle-automation
GIT_COMMITTER_EMAIL: developers@mparticle.com
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}

steps:
- name: Checkout public main branch
uses: actions/checkout@v4
with:
fetch-depth: 0
ref: main

- name: Import GPG Key
uses: crazy-max/ghaction-import-gpg@v4
with:
gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }}
passphrase: ${{ secrets.GPG_PASSPHRASE }}
git_user_signingkey: true
git_commit_gpgsign: true

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: latest

- name: Install dependencies
run: npm ci

- name: Build dist
run: npm run build-dist

- name: Release
run: |
npx semantic-release
- name: Archive npm failure logs
uses: actions/upload-artifact@v3
if: failure()
with:
name: npm-logs
path: ~/.npm/_logs
# release is done from main branch.
confirm-public-repo-main-branch:
name: 'Confirm release is run from public/main branch'
uses: mParticle/mparticle-workflows/.github/workflows/sdk-release-repo-branch-check.yml@main

release:
name: Perform Release
runs-on: ubuntu-latest
needs: confirm-public-repo-main-branch

env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GIT_AUTHOR_NAME: mparticle-automation
GIT_AUTHOR_EMAIL: developers@mparticle.com
GIT_COMMITTER_NAME: mparticle-automation
GIT_COMMITTER_EMAIL: developers@mparticle.com
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}

steps:
- name: Checkout public main branch
uses: actions/checkout@v4
with:
fetch-depth: 0
ref: main

- name: Import GPG Key
uses: crazy-max/ghaction-import-gpg@v4
with:
gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }}
passphrase: ${{ secrets.GPG_PASSPHRASE }}
git_user_signingkey: true
git_commit_gpgsign: true

- name: Setup Node.js
uses: actions/setup-node@v4

- name: Install dependencies
run: npm ci

- name: Build dist
run: npm run build-dist

- name: Release
run: |
npx semantic-release
- name: Archive npm failure logs
uses: actions/upload-artifact@v3
if: failure()
with:
name: npm-logs
path: ~/.npm/_logs
2 changes: 1 addition & 1 deletion .github/workflows/reusable-workflows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,4 @@ jobs:
name: Security Lint Checks
uses: mparticle/mparticle-workflows/.github/workflows/security-checks.yml@stable
with:
base_branch: "main"
base_branch: 'main'
2 changes: 1 addition & 1 deletion .github/workflows/storybook-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,4 @@ jobs:
run: npx playwright install

- name: Run Storybook Tests
run: npm run test-storybook:ci
run: npm run test-storybook:ci
4 changes: 4 additions & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/usr/bin/env sh
. "$(dirname "$0")/_/husky.sh"

npx lint-staged
Empty file added .prettierignore
Empty file.
6 changes: 6 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"semi": false,
"singleQuote": true,
"arrowParens": "avoid",
"printWidth": 120
}
33 changes: 13 additions & 20 deletions .storybook/main.ts
Original file line number Diff line number Diff line change
@@ -1,41 +1,34 @@
import type { StorybookConfig } from "@storybook/react-vite";
import type { StorybookConfig } from '@storybook/react-vite'
import react from '@vitejs/plugin-react'
import { PluginOption, Plugin } from 'vite'
import { withoutVitePlugins } from '@storybook/builder-vite'

type StorybookVitePlugins = { plugins: (PluginOption[] | Plugin)[]; };
type StorybookVitePlugins = { plugins: (PluginOption[] | Plugin)[] }

const config: StorybookConfig & StorybookVitePlugins = {
framework: "@storybook/react-vite",
framework: '@storybook/react-vite',

stories: [
"../src/**/*.mdx",
"../src/**/*.stories.@(ts|tsx)",
],
stories: ['../src/**/*.mdx', '../src/**/*.stories.@(ts|tsx)'],

addons: [
"@storybook/addon-links",
"@storybook/addon-essentials",
"@storybook/addon-interactions",
],
addons: ['@storybook/addon-links', '@storybook/addon-essentials', '@storybook/addon-interactions'],

docs: {
autodocs: true,
defaultName: "Documentation",
defaultName: 'Documentation',
},

plugins: [react()],

async viteFinal(config) {
return ({
return {
...config,
plugins: await withoutVitePlugins(config.plugins, ["vite:dts"]),
});
plugins: await withoutVitePlugins(config.plugins, ['vite:dts']),
}
},

core: {
disableTelemetry: true, // requested by security
disableTelemetry: true, // requested by security
},
};
}

export default config;
export default config
10 changes: 5 additions & 5 deletions .storybook/preview.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import type { Preview } from "@storybook/react";
import type { Preview } from '@storybook/react'

const preview: Preview = {
parameters: {
actions: { argTypesRegex: "^on[A-Z].*" },
actions: { argTypesRegex: '^on[A-Z].*' },

layout: "centered",
layout: 'centered',

controls: {
matchers: {
Expand All @@ -13,6 +13,6 @@ const preview: Preview = {
},
},
},
};
}

export default preview;
export default preview
Loading

0 comments on commit 4cf6c21

Please sign in to comment.