Skip to content

Commit

Permalink
update storybook, stylelint, gitignore, eslint configs
Browse files Browse the repository at this point in the history
stasguma committed Mar 9, 2024
1 parent 3495154 commit 3026400
Showing 6 changed files with 35 additions and 5 deletions.
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
.vscode
/build
node_modules
node_modules
/storybook-static
.env
16 changes: 16 additions & 0 deletions .stylelintrc.js
Original file line number Diff line number Diff line change
@@ -24,5 +24,21 @@ export default {
emptyLineMinimumPropertyThreshold: 6,
},
],
'scss/function-no-unknown': null,
'no-descending-specificity': null,
'selector-class-pattern': [
'^[a-z]+([-]?[a-z0-9]+)*(__[a-z0-9]([-]?[a-z0-9]+)*)?(--[a-z0-9]([-]?[a-z0-9]+)*)?$',
{
resolveNestedSelectors: true,
message: 'Expected class selector "%s" to be lowercase and BEM format',
severity: 'warning',
},
],
'scss/dollar-variable-pattern': [
'^[a-z]+([-]?[a-z0-9]+)*$',
{
ignore: 'local'
}
]
},
};
2 changes: 1 addition & 1 deletion config/build/loaders.ts
Original file line number Diff line number Diff line change
@@ -10,7 +10,7 @@ export const loaders = function (
const { isDev } = options;

const fontLoader = {
test: /\.(woff|woff2)$/i,
test: /\.(woff2|woff)$/i,
type: 'asset/resource',
generator: {
filename: 'fonts/[path][name][ext]',
12 changes: 9 additions & 3 deletions config/storybook/decorators/withThemeDecorator.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,19 @@
import type { Decorator } from '@storybook/react';
import type { ETheme } from '../../../src/app/providers/ThemeProvider';

import { useEffect } from 'react';

import { ThemeProvider } from '../../../src/app/providers/ThemeProvider';
import { changeThemeInDOM } from '../../../src/app/providers/ThemeProvider/lib/changeThemeInDOM';

export const withThemeDecorator: Decorator = (Story, context) => {
const { theme } = context.globals;

useEffect(() => {
changeThemeInDOM(theme as ETheme);
}, [theme]);

return (
<ThemeProvider>
<div data-theme={theme as string}><Story /></div>
</ThemeProvider>
<ThemeProvider><Story /></ThemeProvider>
);
};
1 change: 1 addition & 0 deletions config/storybook/main.ts
Original file line number Diff line number Diff line change
@@ -38,6 +38,7 @@ const config: StorybookConfig = {
}),
docs: {
autodocs: 'tag',
defaultName: 'Overview',
},
webpackFinal: (config: Configuration): Configuration => {
/* added global variable */
5 changes: 5 additions & 0 deletions eslint.config.js
Original file line number Diff line number Diff line change
@@ -122,6 +122,10 @@ export default [
...reactPlugin.configs.recommended.rules,
...reactPlugin.configs['jsx-runtime'].rules,
...i18nextPlugin.configs.recommended.rules,

'@stylistic/jsx-max-props-per-line': [1, {
"maximum": { single: 2, multi: 1 }
}]
},
},
{
@@ -151,6 +155,7 @@ export default [
},
rules: {
...storybookPlugin.configs.recommended.overrides[0].rules,
'i18next/no-literal-string': 'off',
},
},
{

0 comments on commit 3026400

Please sign in to comment.