Skip to content

Commit 69cf694

Browse files
valentinpalkovicstorybook-bot
authored andcommitted
Merge pull request #33884 from storybookjs/copilot/fix-eslint-10-support
Eslint: Fix ESLint 10 compatibility in eslint-plugin-storybook rules (cherry picked from commit 60996ad)
1 parent e79b412 commit 69cf694

File tree

5 files changed

+5
-5
lines changed

5 files changed

+5
-5
lines changed

code/lib/eslint-plugin/src/rules/default-exports.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ export default createStorybookRule({
9999
},
100100
'Program:exit': function (program: TSESTree.Program) {
101101
if (!isCsf4Style && !hasDefaultExport && !hasStoriesOfImport) {
102-
const componentName = getComponentName(program, context.getFilename());
102+
const componentName = getComponentName(program, context.filename);
103103
const firstNonImportStatement = program.body.find((n) => !isImportDeclaration(n));
104104
const node = firstNonImportStatement || program.body[0] || program;
105105

code/lib/eslint-plugin/src/rules/meta-satisfies-type.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ export default createStorybookRule({
3333

3434
create(context) {
3535
// variables should be defined here
36-
const sourceCode = context.getSourceCode();
36+
const sourceCode = context.sourceCode;
3737

3838
//----------------------------------------------------------------------
3939
// Helpers

code/lib/eslint-plugin/src/rules/no-title-property-in-meta.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ export default createStorybookRule({
5151
{
5252
messageId: 'removeTitleInMeta',
5353
fix(fixer) {
54-
const fullText = context.getSourceCode().text;
54+
const fullText = context.sourceCode.text;
5555
const propertyTextWithExtraCharacter = fullText.slice(
5656
titleNode.range[0],
5757
titleNode.range[1] + 1

code/lib/eslint-plugin/src/rules/prefer-pascal-case.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ export default createStorybookRule({
9191
{
9292
messageId: 'convertToPascalCase',
9393
*fix(fixer) {
94-
const fullText = context.getSourceCode().text;
94+
const fullText = context.sourceCode.text;
9595
const fullName = fullText.slice(id.range[0], id.range[1]);
9696
const suffix = fullName.substring(name.length);
9797
const pascal = toPascalCase(name);

code/lib/eslint-plugin/src/rules/use-storybook-testing-library.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ export default createStorybookRule({
6868
//
6969
// import foo, { bar } from 'baz';
7070
// ^ ^ end
71-
const fullText = context.getSourceCode().text;
71+
const fullText = context.sourceCode.text;
7272
const importEnd = node.range[1];
7373
const closingBrace = fullText.indexOf('}', end - 1);
7474
if (closingBrace > -1 && closingBrace <= importEnd) {

0 commit comments

Comments
 (0)