Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: fix eslint errors and warnings #1079

Merged
merged 2 commits into from
Jun 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 12 additions & 3 deletions eslint.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ module.exports = [
'@typescript-eslint/ban-types': 'off',
'@typescript-eslint/no-unused-vars': 'error',
'@typescript-eslint/no-explicit-any': 'error',
'@typescript-eslint/no-non-null-assertion': 'error'
'@typescript-eslint/no-non-null-assertion': 'error',
'@typescript-eslint/no-require-imports': 'off'
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We use imports or requires based on the file (test files, examples, eslint config itself, postinstall, etc.). Instead of having to disable it or ignore it for every file we want, easier to just disable the rule and let us decide when to use require or import per file.

}
},
{
Expand All @@ -54,11 +55,19 @@ module.exports = [
}
},
{
files: ['**/*.test.ts', '**/*.test.tsx', '**/*.spec.ts', '**/*.spec.tsx'],
files: [
'**/*.test.ts',
'**/*.test.tsx',
'**/*.spec.ts',
'**/*.spec.tsx',
'**/test/**',
'**/tests/**'
],
rules: {
'@typescript-eslint/no-empty-function': 'off',
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/no-non-null-assertion': 'off'
'@typescript-eslint/no-non-null-assertion': 'off',
'@typescript-eslint/no-unused-expressions': 'off'
}
},
{
Expand Down
1 change: 0 additions & 1 deletion packages/playwright/src/AxePartialRunner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,5 +47,4 @@ export default class AxePartialRunner {
// See: https://stackoverflow.com/questions/40920179/should-i-refrain-from-handling-promise-rejection-asynchronously
export const caught = ((f: () => void) => {
return <T>(p: Promise<T>): Promise<T> => (p.catch(f), p);
/* eslint-disable @typescript-eslint/no-empty-function */
})(() => {});
1 change: 0 additions & 1 deletion packages/puppeteer/src/axePartialRunner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,5 +48,4 @@ export class AxePartialRunner {
// See: https://stackoverflow.com/questions/40920179/should-i-refrain-from-handling-promise-rejection-asynchronously
export const caught = ((f: () => void) => {
return <T>(p: Promise<T>): Promise<T> => (p.catch(f), p);
/* eslint-disable @typescript-eslint/no-empty-function */
})(() => {});
1 change: 0 additions & 1 deletion packages/react/test/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ reactAxe(React, ReactDOM, 1000, {
checks: [
{
id: 'my-check',
// eslint-disable-next-line @typescript-eslint/explicit-function-return-type, @typescript-eslint/no-empty-function
evaluate() {}
}
],
Expand Down
2 changes: 0 additions & 2 deletions packages/webdriverio/test/axe-webdriverio.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@ import { fixturesPath } from 'axe-test-fixtures';
const connectToChromeDriver = (port: number): Promise<void> => {
let socket: net.Socket;
return new Promise((resolve, reject) => {
// eslint-disable-next-line prefer-const

// Give up after 1s
const timer = setTimeout(() => {
socket.destroy();
Expand Down
1 change: 0 additions & 1 deletion packages/webdriverjs/src/axe-injector.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,6 @@ export default class AxeInjectorLegacy {
// does not return a "real promise" (ManagedPromise)
// and we want to await it.
return new Promise((resolve, reject) => {
/* eslint-disable no-undef */
this.driver
// https://github.com/vercel/pkg/issues/676
// we need to pass a string vs a function so we manually stringified the function
Expand Down
Loading