Skip to content

Commit ec47280

Browse files
authored
chore(eslint): check all relevant files (#7369)
1 parent 950d95e commit ec47280

26 files changed

+83
-51
lines changed

.storybook/manager.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@ import { addons } from '@storybook/manager-api';
22
import { Fiori4ReactTheme } from './theme';
33

44
addons.setConfig({
5-
//todo: check error
6-
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
75
theme: Fiori4ReactTheme,
86
/**
97
* show story component as full screen

.storybook/preview.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,9 @@ const preview: Preview = {
3232

3333
useEffect(() => {
3434
if (language === 'local') {
35-
setLanguage(null);
35+
void setLanguage(null);
3636
} else {
37-
setLanguage(language);
37+
void setLanguage(language);
3838
}
3939
}, [language]);
4040

@@ -48,11 +48,11 @@ const preview: Preview = {
4848

4949
useEffect(() => {
5050
document.querySelector('html').setAttribute('dir', direction);
51-
applyDirection();
51+
void applyDirection();
5252
}, [direction]);
5353

5454
useEffect(() => {
55-
setTheme(theme);
55+
void setTheme(theme);
5656
}, [theme]);
5757

5858
return (

docs/knowledgeBaseExamples/ThemeableThemingParameters.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ export const ThemeableCSSVars = () => {
139139
onChange={(e) => {
140140
const theme = e.detail.selectedOption.dataset.value;
141141
setCurrentTheme(theme);
142-
setTheme(theme);
142+
void setTheme(theme);
143143
}}
144144
>
145145
{MAPPED_THEMES.map(({ title, value }) => (

eslint.config.mjs

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
// @ts-check
2-
1+
import { fileURLToPath } from 'node:url';
2+
import { includeIgnoreFile } from '@eslint/compat';
33
import eslint from '@eslint/js';
44
import importPlugin from 'eslint-plugin-import';
55
import noOnlyTests from 'eslint-plugin-no-only-tests';
@@ -24,16 +24,17 @@ const ignorePatterns = {
2424
'packages/main/src/generated',
2525
'packages/cypress-commands/dist',
2626
'**/generated',
27-
'**/scripts',
28-
'**/shared',
29-
'**/examples',
30-
'**/templates',
3127
'**/*.module.css.ts',
3228
'.yarn',
29+
'.out/**',
30+
'**/out/**',
31+
'**/examples',
32+
'**/templates',
3333
],
3434
};
3535

3636
const config = tseslint.config(
37+
includeIgnoreFile(fileURLToPath(new URL('.gitignore', import.meta.url))),
3738
ignorePatterns,
3839
eslint.configs.recommended,
3940
// typescript-eslint shared configs
@@ -249,16 +250,11 @@ const config = tseslint.config(
249250
},
250251

251252
{
252-
files: ['packages/cli/**/*, scripts/**/*', '.github/**/*', 'config/**/*'],
253+
files: ['packages/cli/**/*', 'scripts/**/*', '.github/**/*', 'config/**/*'],
253254
languageOptions: {
254255
globals: {
255256
...globals.node,
256257
},
257-
parserOptions: {
258-
projectService: {
259-
allowDefaultProject: ['config/*.js', '.github/*.mjs'],
260-
},
261-
},
262258
},
263259
},
264260

@@ -268,6 +264,7 @@ const config = tseslint.config(
268264
'@typescript-eslint/no-unsafe-assignment': 'off',
269265
'@typescript-eslint/no-unsafe-call': 'off',
270266
'@typescript-eslint/no-unsafe-member-access': 'off',
267+
'@typescript-eslint/no-unsafe-argument': 'off',
271268
'@typescript-eslint/no-explicit-any': 'off',
272269
},
273270
},

package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
"clean": "tsc --build --clean && tsc --build tsconfig.build.json --clean && rimraf temp .out && lerna run clean",
2020
"clean:remove-modules": "yarn clean && rimraf node_modules",
2121
"prettier:all": "prettier --write --config ./prettier.config.js \"**/*\"",
22-
"lint": "eslint packages",
22+
"lint": "eslint .",
2323
"lerna:version-dryrun": "lerna version --conventional-graduate --no-git-tag-version --no-push",
2424
"wrappers:main": "node packages/cli/dist/bin/index.js create-wrappers --packageName @ui5/webcomponents --out ./packages/main/src/webComponents --additionalComponentNote 'This is a UI5 Web Component! [Repository](https://github.com/SAP/ui5-webcomponents) | [Documentation](https://sap.github.io/ui5-webcomponents/)'",
2525
"wrappers:fiori": "node packages/cli/dist/bin/index.js create-wrappers --packageName @ui5/webcomponents-fiori --out ./packages/main/src/webComponents --additionalComponentNote 'This is a UI5 Web Component! [Repository](https://github.com/SAP/ui5-webcomponents) | [Documentation](https://sap.github.io/ui5-webcomponents/)'",
@@ -61,6 +61,7 @@
6161
"@babel/preset-react": "7.27.1",
6262
"@babel/preset-typescript": "7.27.1",
6363
"@cypress/code-coverage": "3.14.2",
64+
"@eslint/compat": "1.2.9",
6465
"@eslint/js": "9.27.0",
6566
"@semantic-release/github": "11.0.2",
6667
"@testing-library/cypress": "10.0.3",
@@ -83,7 +84,7 @@
8384
"eslint-plugin-no-only-tests": "3.3.0",
8485
"eslint-plugin-prettier": "5.4.0",
8586
"eslint-plugin-react": "7.37.5",
86-
"eslint-plugin-react-hooks": "beta",
87+
"eslint-plugin-react-hooks": "5.2.0",
8788
"eslint-plugin-storybook": "0.12.0",
8889
"glob": "11.0.2",
8990
"globals": "16.1.0",

packages/cli/src/scripts/codemod/main.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,10 @@ const __dirname = path.dirname(__filename);
99

1010
const transformerDir = path.resolve(__dirname, 'transforms');
1111

12+
// eslint-disable-next-line @typescript-eslint/require-await
1213
export default async function runCodemod(transform: string, inputDir: string, useTypeScript: boolean) {
1314
if (!SUPPORTED_TRANSFORMERS.includes(transform)) {
14-
// eslint-disable-next-line no-console
1515
console.error('Invalid transform choice, pick one of:');
16-
// eslint-disable-next-line no-console
1716
console.error(SUPPORTED_TRANSFORMERS.map((x) => '- ' + x).join('\n'));
1817
process.exit(1);
1918
}
@@ -32,7 +31,6 @@ export default async function runCodemod(transform: string, inputDir: string, us
3231

3332
jscodeshiftOptions.push('--ignore-pattern=**/node_modules/**');
3433

35-
// eslint-disable-next-line no-console
3634
console.log(`Executing 'npx jscodeshift ${jscodeshiftOptions.join(' ')} ${inputDir}'`);
3735
childProcess.spawnSync('npx', ['jscodeshift', ...jscodeshiftOptions, inputDir], {
3836
stdio: 'inherit',

packages/cli/src/scripts/codemod/transforms/v2/main.cts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
import type { API, ASTPath, Collection, FileInfo, JSCodeshift, JSXElement, Options } from 'jscodeshift';
1+
/* eslint-disable @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-argument, @typescript-eslint/no-require-imports, @typescript-eslint/no-unsafe-return, @typescript-eslint/no-unsafe-call, @typescript-eslint/no-unsafe-member-access,import/order */
2+
3+
import type { API, ASTPath, Collection, FileInfo, JSCodeshift, JSXElement } from 'jscodeshift';
24

35
const config = require('./codemodConfig.json');
46

@@ -70,7 +72,7 @@ function extractValueFromProp(
7072
return null;
7173
}
7274

73-
export default function transform(file: FileInfo, api: API, options?: Options): string | undefined {
75+
export default function transform(file: FileInfo, api: API): string | undefined {
7476
const j = api.jscodeshift;
7577
const root = j(file.source);
7678

packages/cli/src/scripts/create-wrappers/AbstractRenderer.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ export enum RenderingPhase {
1212
export abstract class AbstractRenderer {
1313
public readonly phase!: RenderingPhase;
1414

15-
public prepare(context: WebComponentWrapper) {
15+
public prepare(_context: WebComponentWrapper) {
1616
// optional
1717
}
1818
abstract render(context: WebComponentWrapper): string;

packages/cli/src/scripts/create-wrappers/AttributesRenderer.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import {
88
} from '../../util/formatters.js';
99
import { resolveReferenceImports } from '../../util/referenceResolver.js';
1010
import { AbstractRenderer, RenderingPhase } from './AbstractRenderer.js';
11-
import { WebComponentWrapper } from './WebComponentWrapper.js';
11+
import type { WebComponentWrapper } from './WebComponentWrapper.js';
1212

1313
const loggedTypes = new Set<string>();
1414

packages/cli/src/scripts/create-wrappers/ComponentRenderer.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import type * as CEM from '@ui5/webcomponents-tools/lib/cem/types-internal.d.ts'
22
import dedent from 'dedent';
33
import { sinceFilter, snakeCaseToCamelCase, summaryFormatter } from '../../util/formatters.js';
44
import { AbstractRenderer, RenderingPhase } from './AbstractRenderer.js';
5-
import { WebComponentWrapper } from './WebComponentWrapper.js';
5+
import type { WebComponentWrapper } from './WebComponentWrapper.js';
66

77
export class ComponentRenderer extends AbstractRenderer {
88
public phase = RenderingPhase.component;

0 commit comments

Comments
 (0)