Skip to content

Commit

Permalink
Add eslint-plugin-storybook (flat config canary version) to eslint.co…
Browse files Browse the repository at this point in the history
…nfig.mjs
  • Loading branch information
iva2k committed Jul 14, 2024
1 parent f2aad33 commit f085323
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 117 deletions.
26 changes: 25 additions & 1 deletion eslint.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import sveltePlugin from 'eslint-plugin-svelte';
import pluginImportX from 'eslint-plugin-import-x';
import playwright from 'eslint-plugin-playwright';
import vitest from 'eslint-plugin-vitest';
import storybook from 'eslint-plugin-storybook';

// Parsers
const { parser: tsParser } = tseslint;
Expand Down Expand Up @@ -165,6 +166,12 @@ const RULES = {

// import-x:
'import-x/no-named-as-default-member': 'off'
},
storybook: {
'@typescript-eslint/no-unsafe-assignment': 'off',
'@typescript-eslint/no-unsafe-call': 'off',
'@typescript-eslint/no-unsafe-member-access': 'off',
'import-x/no-anonymous-default-export': 'off'
}
};

Expand Down Expand Up @@ -417,6 +424,23 @@ export default tseslint.config(
...vitest.environments.env.globals
}
}
}
},
/**/

...patchFilesPrefix(storybook.configs['flat/recommended']),
// storybook sets files: ['*.stories.@(ts|tsx|js|jsx|mjs|cjs)', '*.story.@(ts|tsx|js|jsx|mjs|cjs)'],
{
// Storybook Overrides
name: 'config-storybook',
// storybook.configs['flat/recommended'][0] - setup, [1] - *.stories.*ts/*js/tsx/jsx, [2] - .storybook/main.*js/*ts
files: arrayFilePathsDeprefix(storybook.configs['flat/recommended'][1], 'files', '*.', '**/*.'),
// files: ['**/*.stories.@(ts|tsx|js|jsx|mjs|cjs)', '**/*.story.@(ts|tsx|js|jsx|mjs|cjs)'],
rules: {
...RULES.ts,
// ...storybook.configs['flat/recommended'][0].rules,
...storybook.configs['flat/recommended'][1].rules,
// ...storybook.configs['flat/recommended'][2].rules,
...RULES.storybook
}
}
);
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@
"eslint-import-resolver-typescript": "^3.6.1",
"eslint-plugin-import-x": "^3.0.1",
"eslint-plugin-playwright": "^1.6.2",
"eslint-plugin-storybook": "^0.8.0",
"eslint-plugin-storybook": "0.9.0--canary.156.ed236ca.0",
"eslint-plugin-svelte": "^2.36.0",
"eslint-plugin-vitest": "^0.5.4",
"glob": "^10.3.10",
Expand Down
129 changes: 14 additions & 115 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit f085323

Please sign in to comment.