Skip to content

Commit

Permalink
chore(lint): update and fix prettier & eslint (#4452)
Browse files Browse the repository at this point in the history
- chore(deps): update dependency prettier to v3
- chore(deps): update typescript-eslint monorepo to v6 (major)
- chore(deps): update dependency eslint-plugin-prettier to v5
- disable new `@typescript-eslint/class-methods-use-this` rule
- migrate some logical or (`||`) operators to nullish coalescing (`??`) operator
  • Loading branch information
nicojs authored Sep 29, 2023
1 parent ad03cf6 commit 6bddd41
Show file tree
Hide file tree
Showing 225 changed files with 1,290 additions and 873 deletions.
2 changes: 2 additions & 0 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ module.exports = {
},
],
'import/no-default-export': 'error',
'import/no-duplicates': 'error',
'import/no-extraneous-dependencies': ['error', {'devDependencies': false, 'optionalDependencies': false, 'peerDependencies': true}],

// prettier rules
Expand Down Expand Up @@ -69,6 +70,7 @@ module.exports = {
],
'@typescript-eslint/no-unused-vars': ['error', { argsIgnorePattern: '^_*', ignoreRestSiblings: true, varsIgnorePattern: '^_' }],
'@typescript-eslint/no-floating-promises': 'error',
'@typescript-eslint/class-methods-use-this': 'off',

// disabled typescript-eslint rules we should enable in some way

Expand Down
2 changes: 1 addition & 1 deletion e2e/tasks/bootstrap.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ from(dirs)
}
}
return dir;
}, concurrency)
}, concurrency),
)
.subscribe({
next: (dir) => {
Expand Down
2 changes: 1 addition & 1 deletion e2e/tasks/run-e2e-tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ function runE2eTests() {
const concurrency = Math.max(os.cpus().length / 2, 2);
return test$.pipe(
mergeAll(concurrency),
tap((testDir) => console.log(`\u2714 ${testDir} tested (${++testsRan}/${testDirs.length})`))
tap((testDir) => console.log(`\u2714 ${testDir} tested (${++testsRan}/${testDirs.length})`)),
);
}

Expand Down
2 changes: 1 addition & 1 deletion e2e/test/disable-bail/verify/verify.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ describe('disableBail', () => {
*/
async function arrangeActAssertBailWasDisabled(
testRunner,
expectedKilledBy = ['add should result in 42 for 40 and 2', 'add should result in 42 for 41 and 1']
expectedKilledBy = ['add should result in 42 for 40 and 2', 'add should result in 42 for 41 and 1'],
) {
const { exitCode } = execStryker(`stryker run --testRunner ${testRunner}`);
expect(exitCode).eq(0);
Expand Down
2 changes: 1 addition & 1 deletion e2e/test/mono-schema/verify/verify.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import { beforeEach } from 'mocha';
* @type {import('ajv').SchemaObject}
*/
const monoSchema = JSON.parse(
fs.readFileSync(new URL('../../../node_modules/@stryker-mutator/core/schema/stryker-schema.json', import.meta.url), 'utf-8')
fs.readFileSync(new URL('../../../node_modules/@stryker-mutator/core/schema/stryker-schema.json', import.meta.url), 'utf-8'),
);
const valid = JSON.parse(fs.readFileSync(new URL('../test/valid.json', import.meta.url), 'utf-8'));
const invalid = JSON.parse(fs.readFileSync(new URL('../test/invalid.json', import.meta.url), 'utf-8'));
Expand Down
2 changes: 1 addition & 1 deletion e2e/test/options-validation/verify/verify.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ describe('Options validation', () => {
});
it('should report about unserializable options', () => {
expect(result.stdout).includes(
' Config option "myCustomReporter.filter" is not (fully) serializable. Primitive type "function" has no JSON representation. Any test runner or checker worker processes might not receive this value as intended.'
' Config option "myCustomReporter.filter" is not (fully) serializable. Primitive type "function" has no JSON representation. Any test runner or checker worker processes might not receive this value as intended.',
);
});
});
Expand Down
4 changes: 2 additions & 2 deletions e2e/test/reporters-e2e/verify/verify.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,12 @@ describe('Verify stryker has ran correctly', () => {
const files = Object.fromEntries(
Object.entries(result.files)
.map(([fileName, fileResult]) => [fileName, { ...fileResult, mutants: fileResult.mutants.sort((a, b) => (a.id < b.id ? -1 : 1)) }])
.sort(([a], [b]) => (a < b ? -1 : 1))
.sort(([a], [b]) => (a < b ? -1 : 1)),
);
const testFiles = Object.fromEntries(
Object.entries(result.testFiles)
.map(([fileName, fileResult]) => [fileName, { ...fileResult, tests: fileResult.tests.sort((a, b) => (a.id < b.id ? -1 : 1)) }])
.sort(([a], [b]) => (a < b ? -1 : 1))
.sort(([a], [b]) => (a < b ? -1 : 1)),
);
expect(files).matchSnapshot();
expect(testFiles).matchSnapshot();
Expand Down
Loading

0 comments on commit 6bddd41

Please sign in to comment.