Skip to content

Commit

Permalink
Merge pull request #41 from KaiHotz/rewrite
Browse files Browse the repository at this point in the history
Rewrite
  • Loading branch information
KaiHotz committed Aug 25, 2023
2 parents 1514ff9 + 9fd7b57 commit 32e3ba2
Show file tree
Hide file tree
Showing 30 changed files with 16,798 additions and 28,766 deletions.
63 changes: 0 additions & 63 deletions .babelrc.cjs

This file was deleted.

6 changes: 6 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,9 @@ dist
node_modules
coverage
storybook-static
.storybook

**/__tests__
*.test.jsx
*.test.tsx

133 changes: 124 additions & 9 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -1,22 +1,137 @@
module.exports = {
extends: ['react-app', 'react-app/jest', 'plugin:react/recommended', 'plugin:prettier/recommended', 'plugin:storybook/recommended'],
plugins: ['react', 'prettier'],
root: true,
extends: [
'plugin:react/recommended',
'plugin:react-hooks/recommended',
'plugin:react/jsx-runtime',
'plugin:storybook/recommended',
'plugin:import/recommended',
'plugin:jsx-a11y/recommended',
'prettier',
],
plugins: ['react', 'react-hooks', 'storybook', 'import', 'jsx-a11y'],
env: {
browser: true,
node: true,
jest: true,
browser: true,
},
settings: {
ecmaVersion: 'latest',
react: {
version: 'detect',
},
'import/resolver': {
node: true,
typescript: true,
},
},
root: true,
parser: '@typescript-eslint/parser',
parserOptions: {
ecmaVersion: 11,
ecmaVersion: 'latest',
sourceType: 'module',
ecmaFeatures: {
jsx: true,
},
},
ignorePatterns: [
'!*.js',
'!.storybook',
'.*.js',
'*.json',
'scripts',
'src/graphql/generated/*',
],
rules: {
'newline-before-return': 'error',
'import/no-anonymous-default-export': 0,
'react/jsx-uses-react': 'error',
'react/jsx-uses-vars': 'error',
'no-console': 'warn',
'no-debugger': 'warn',
'no-warning-comments': 'warn',
'object-shorthand': 'error',
'no-param-reassign': [
'error',
{
props: true,
ignorePropertyModificationsFor: ['acc', 'next'],
},
],
'react/prop-types': 'off',
'react/self-closing-comp': [
'error',
{
component: true,
html: true,
},
],
'react/jsx-props-no-spreading': 'off',
'react/jsx-curly-brace-presence': [
'error',
{ props: 'never', children: 'never' },
],
'jsx-a11y/anchor-is-valid': [
'error',
{
components: ['Link', 'NextLink', 'RouterLink'],
aspects: ['invalidHref'],
},
],
'import/order': [
'error',
{
'newlines-between': 'always',
pathGroups: [
{
pattern: '$/**',
group: 'internal',
},
],
pathGroupsExcludedImportTypes: ['builtin'],
groups: [
['builtin', 'external'],
['internal'],
['parent', 'sibling', 'index'],
'unknown',
],
},
],
'import/no-extraneous-dependencies': 'error',
},
ignorePatterns: [".eslintrc.cjs", "vitest.config.ts", "setupTests.ts"],
overrides: [
{
files: ['*.ts', '*.tsx'],
extends: [
'plugin:@typescript-eslint/eslint-recommended',
'plugin:@typescript-eslint/recommended',
'plugin:@typescript-eslint/recommended-requiring-type-checking',
'plugin:import/typescript',
],
plugins: ['@typescript-eslint/eslint-plugin'],
parser: '@typescript-eslint/parser',
parserOptions: {
project: ['./tsconfig.json'],
tsconfigRootDir: __dirname,
},
rules: {
'@typescript-eslint/no-use-before-define': [
'error',
{ functions: false },
],
'@typescript-eslint/no-floating-promises': [
'error',
{ ignoreVoid: true },
],
},
},
{
files: [
'*stories.*',
'src/pages/**/*.tsx',
'additional.d.ts',
'**/__mocks__/**',
],
rules: {
'import/no-anonymous-default-export': 'off',
'import/no-default-export': 'off',
},
},
],
};
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

# dependencies
node_modules
.yarn/cache

# builds
build
Expand Down
45 changes: 0 additions & 45 deletions .npmignore

This file was deleted.

22 changes: 22 additions & 0 deletions .prettierrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"singleQuote": true,
"bracketSpacing": true,
"arrowParens": "always",
"printWidth": 140,
"quoteProps": "preserve",
"trailingComma": "all",
"overrides": [
{
"files": "*.jsx",
"options": {
"printWidth": 120
}
},
{
"files": "*.tsx",
"options": {
"printWidth": 120
}
}
]
}
8 changes: 5 additions & 3 deletions .storybook/preview.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import type { Preview } from '@storybook/react';
import type { Preview } from "@storybook/react";

export const preview: Preview = {
const preview: Preview = {
parameters: {
actions: { argTypesRegex: '^on[A-Z].*' },
actions: { argTypesRegex: "^on[A-Z].*" },
controls: {
matchers: {
color: /(background|color)$/i,
Expand All @@ -11,3 +11,5 @@ export const preview: Preview = {
},
},
};

export default preview;
Binary file added .yarn/install-state.gz
Binary file not shown.
874 changes: 874 additions & 0 deletions .yarn/releases/yarn-3.6.3.cjs

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions .yarnrc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
nodeLinker: node-modules

yarnPath: .yarn/releases/yarn-3.6.3.cjs
17 changes: 10 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ yarn test:coverage

Linting is set up through [ESLint](https://eslint.org/) and configured with [eslint-config-react-app](https://www.npmjs.com/package/eslint-config-react-app) and
[eslint-config-prettier](https://github.com/prettier/eslint-config-prettier).
You can modify linting rules by overriding them in the `.eslintrc.json` file.
You can modify linting rules by overriding them in the `.eslintrc.cjs` file.

```
yarn lint
Expand All @@ -75,7 +75,7 @@ yarn lint:fix

## Publishing your library to NPM

To release your library to NPM or your private Registry, make sure you have an active account at [NPM](https://www.npmjs.com/), your `.npmrc` file is correctly setup and the repository url in `package.json` file is set to your repository url, then:
To release your library to NPM or your private Registry, make sure you have an active account at [NPM](https://www.npmjs.com/), your `.npmrc` file is correctly setup and the registry url at publishConfig in `package.json` file is set to your repository url, then:

```
yarn release
Expand All @@ -87,7 +87,7 @@ For custom layouts, styling and more information about Storybook, please refer t

#### Deploy Storybook to GitHub Pages

Make sure the repository url in `package.json` file is set to your repository url, then:
Make sure the homepage url in `package.json` file is set to your githup pages url, then:

```
yarn deploy
Expand All @@ -107,9 +107,12 @@ yarn deploy
- `yarn stylelint`: Runs only the style linter.
- `yarn stylelint:fix`: Runs only the style linter and fixes automatic fixable issues.
- `yarn check-types`: Runs typescript type checker.
- `yarn ci`: Runs Linting, tests and type checker all together.
- `yarn release` : Publishes your Library on NPM or your private Registry (depending on your config in your `.npmrc` file).
- `yarn deploy`: Deploys the Styleguide to GitHub Pages.

- `yarn deploy`: Builds and deploys Storybook to GitHub Pages.
- `yarn audit:fix`: Is similar to npm audit --fix, it checks dependencies for reported vulnerabilities and tire to patch them.
- `yarn storybook`: Same as yarn start, to serve storybook.
- `yarn storybook:build`: Generates rthe build for storybook to be deployed wherever you need.

## Resources

Expand All @@ -123,8 +126,9 @@ yarn deploy
- [Storybook](https://storybook.js.org/)

### Testing
- [Jest](https://facebook.github.io/jest/)
- [Vitest](https://vitest.dev/)
- [@testing-library/react](https://testing-library.com/docs/react-testing-library/intro/)
- [@testing-library/jest-dom](https://github.com/testing-library/jest-dom)

### Linting
- [ESLint](https://eslint.org/)
Expand All @@ -133,5 +137,4 @@ yarn deploy
- [stylelint-prettier](https://github.com/prettier/stylelint-prettier)
- [stylelint-scss](https://github.com/kristerkari/stylelint-scss)
### Compiler
- [Babel 7](https://babeljs.io/)
- [Typescript](https://www.typescriptlang.org/)
12 changes: 0 additions & 12 deletions config/cssTransform.js

This file was deleted.

Loading

0 comments on commit 32e3ba2

Please sign in to comment.