From a5bc0492bc3c91d736f8bf53ac2f984e67824b5a Mon Sep 17 00:00:00 2001 From: Kamil Piwko Date: Sat, 30 Apr 2022 16:40:48 +0200 Subject: [PATCH] lint test --- .eslintrc.js | 10 +- .stylelintrc.js | 2 +- package.json | 15 +- src/lib/components/index.ts | 2 +- src/lib/index.ts | 2 +- src/stories/Button.stories.tsx | 30 +-- src/stories/Header.stories.tsx | 18 +- src/stories/Header.tsx | 35 +-- src/stories/Introduction.stories.mdx | 43 ++-- src/stories/Page.stories.tsx | 24 +- src/stories/Page.tsx | 28 +-- src/stories/button.css | 7 +- src/stories/header.css | 2 +- tsconfig.json | 3 +- tsconfig.node.json | 3 +- yarn.lock | 346 ++++++++++++--------------- 16 files changed, 268 insertions(+), 302 deletions(-) diff --git a/.eslintrc.js b/.eslintrc.js index c0300f21..43e458cd 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -3,12 +3,12 @@ module.exports = { parser: '@typescript-eslint/parser', parserOptions: { project: './tsconfig.json', + extraFileExtensions: ['.md', '.mdx'], }, root: true, plugins: ['@typescript-eslint', 'react', 'prettier'], env: { browser: true, - node: true, es6: true, }, @@ -18,7 +18,13 @@ module.exports = { 'plugin:react/recommended', 'plugin:react-hooks/recommended', 'plugin:prettier/recommended', - 'plugin:mdx/recommended', + ], + overrides: [ + { + files: ['src/**/*.mdx', 'src/**/*.md'], + extends: ['eslint:recommended', 'plugin:mdx/recommended', 'plugin:prettier/recommended'], + parser: 'eslint-mdx', + }, ], settings: { react: { diff --git a/.stylelintrc.js b/.stylelintrc.js index 2f866efc..c5df51c9 100644 --- a/.stylelintrc.js +++ b/.stylelintrc.js @@ -1,5 +1,5 @@ module.exports = { - extends: 'stylelint-config-standard', + extends: ['stylelint-prettier/recommended'], rules: { 'alpha-value-notation': 'number', 'selector-class-pattern': null, diff --git a/package.json b/package.json index 9ed9af93..00b33302 100644 --- a/package.json +++ b/package.json @@ -1,4 +1,7 @@ { + "resolutions": { + "@types/react": "^17.0.10" + }, "name": "betterplace-design-system", "author": "betterplace ", "license": "Apache-2.0", @@ -42,7 +45,7 @@ "@storybook/builder-vite": "^0.1.28", "@storybook/react": "^6.4.21", "@storybook/testing-library": "^0.0.9", - "@types/react": "^17.0.33", + "@types/react": "^17.0.10", "@types/react-dom": "^17.0.10", "@typescript-eslint/eslint-plugin": "^5.20.0", "@typescript-eslint/parser": "^5.20.0", @@ -50,6 +53,7 @@ "babel-loader": "^8.2.4", "eslint": "^8.13.0", "eslint-config-prettier": "^8.5.0", + "eslint-mdx": "^1.17.0", "eslint-plugin-import": "^2.26.0", "eslint-plugin-jest": "^26.1.5", "eslint-plugin-mdx": "^1.17.0", @@ -61,6 +65,7 @@ "storybook-addon-designs": "^6.2.1", "stylelint": "^14.8.1", "stylelint-config-prettier": "^9.0.3", + "stylelint-config-standard": "^25.0.0", "stylelint-prettier": "^2.0.0", "typescript": "^4.5.4", "vite": "^2.9.0", @@ -68,7 +73,11 @@ "vite-plugin-eslint": "^1.6.0" }, "lint-staged": { - "*.{ts, tsx, mdx}": "eslint --cache --fix", - "*.{css, scss}": "stylelint --fix" + "**/*.ts?(x)": "bash -c tsc -p ./tsconfig.json --noEmit", + "**/*.{ts, tsx, mdx}": "eslint --cache --fix", + "*.?(s)css": [ + "stylelint --fix", + "stylelint" + ] } } diff --git a/src/lib/components/index.ts b/src/lib/components/index.ts index 26e59f00..c276fcc6 100644 --- a/src/lib/components/index.ts +++ b/src/lib/components/index.ts @@ -1 +1 @@ -export * from './sample'; +export * from './sample' diff --git a/src/lib/index.ts b/src/lib/index.ts index 40b494c5..cb64ac1b 100644 --- a/src/lib/index.ts +++ b/src/lib/index.ts @@ -1 +1 @@ -export * from "./components"; +export * from './components' diff --git a/src/stories/Button.stories.tsx b/src/stories/Button.stories.tsx index 35bd3c8e..829d3a8b 100644 --- a/src/stories/Button.stories.tsx +++ b/src/stories/Button.stories.tsx @@ -1,7 +1,7 @@ -import React from 'react'; -import { ComponentStory, ComponentMeta } from '@storybook/react'; +import React from 'react' +import { ComponentStory, ComponentMeta } from '@storybook/react' -import { Button } from './Button'; +import { Button } from './Button' // More on default export: https://storybook.js.org/docs/react/writing-stories/introduction#default-export export default { @@ -16,33 +16,33 @@ export default { type: 'figspec', accessToken: process.env.STORYBOOK_FIGMA_ACCESS_TOKEN, url: 'https://www.figma.com/file/PJ7OUutWRrSHW6qgaPNW1l/Design-System-betterplace-GENERAL?node-id=361%3A1874', - } - } -} as ComponentMeta; + }, + }, +} as ComponentMeta // More on component templates: https://storybook.js.org/docs/react/writing-stories/introduction#using-args -const Template: ComponentStory = (args) =>