Skip to content

Commit

Permalink
chore(linting): use shorthand
Browse files Browse the repository at this point in the history
  • Loading branch information
webdeveric committed Jul 14, 2024
1 parent ec82c66 commit 1515f8f
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions test/plugin.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -243,8 +243,8 @@ describe('Methods', () => {
const manifest = new WebpackAssetsManifest();
const methods = ['set', 'setRaw'] satisfies (keyof WebpackAssetsManifest)[];

['some/image.jpg', 'some\\image.jpg'].forEach(key => {
methods.forEach(method => {
['some/image.jpg', 'some\\image.jpg'].forEach((key) => {
methods.forEach((method) => {
manifest[method](key, 'image.jpg');

expect(manifest.has(key)).toBeTruthy();
Expand Down Expand Up @@ -311,7 +311,7 @@ describe('Methods', () => {
it('Returns a Proxy', () => {
const manifest = new WebpackAssetsManifest();

[undefined, false, true].forEach(raw => {
[undefined, false, true].forEach((raw) => {
const proxy = manifest.getProxy(raw);

expect(proxy).instanceOf(WebpackAssetsManifest);
Expand Down Expand Up @@ -390,7 +390,7 @@ describe('Options', () => {
it('Should use custom comparison function', () => {
const manifest = new WebpackAssetsManifest({
assets,
sortManifest: function (left, right) {
sortManifest(left, right) {
return left.localeCompare(right);
},
space: 0,
Expand Down Expand Up @@ -438,7 +438,7 @@ describe('Options', () => {
const manifest = new WebpackAssetsManifest({
assets,
space: 0,
replacer: function (_key, value) {
replacer(_key, value) {
if (typeof value === 'string') {
return value.toUpperCase();
}
Expand All @@ -464,7 +464,7 @@ describe('Options', () => {
space: 0,
});

Object.keys(assets).forEach(key => {
Object.keys(assets).forEach((key) => {
manifest.set(key, assets[key]);
});

Expand Down Expand Up @@ -783,7 +783,7 @@ describe('Options', () => {
integrity: true,
integrityHashes: ['md5'],
apply(manifest) {
manifest.compiler?.hooks.compilation.tap('test', compilation => {
manifest.compiler?.hooks.compilation.tap('test', (compilation) => {
vi.spyOn(compilation.assetsInfo, 'get').mockImplementation(() => ({
[manifest.options.integrityPropertyName]: 'test',
}));
Expand Down Expand Up @@ -972,17 +972,17 @@ describe('Options', () => {
type WriteToDiskFn = Exclude<NonNullable<DevMiddleware['writeToDisk']>, boolean>;
type DevMiddlewareWithWriteToDiskFn = Omit<DevMiddleware, 'writeToDisk'> & { writeToDisk: WriteToDiskFn };

let spy: MockInstance<Parameters<WriteToDiskFn>, ReturnType<WriteToDiskFn>> | undefined;
let spy: MockInstance<WriteToDiskFn> | undefined;

compiler.hooks.compilation.tap('test', compilation => {
compiler.hooks.compilation.tap('test', (compilation) => {
if (
isObject(compilation.options.devServer) &&
isObject<DevMiddlewareWithWriteToDiskFn>(compilation.options.devServer.devMiddleware) &&
typeof compilation.options.devServer.devMiddleware.writeToDisk === 'function'
) {
spy = vi
.spyOn(compilation.options.devServer.devMiddleware, 'writeToDisk')
.mockImplementation(filePath => manifest.getOutputPath() === filePath);
.mockImplementation((filePath) => manifest.getOutputPath() === filePath);
}
});

Expand Down Expand Up @@ -1036,7 +1036,7 @@ describe('Options', () => {
const { manifest } = create(configs.hello(), {
apply: () => {},
customize: () => {},
transform: assets => assets,
transform: (assets) => assets,
done: async () => {},
});

Expand Down Expand Up @@ -1094,7 +1094,7 @@ describe('Options', () => {

describe('Options', function () {
it('Options can be altered with a hook', function () {
const mock = vi.fn(options => {
const mock = vi.fn((options) => {
options.space = 0;

return options;
Expand Down

0 comments on commit 1515f8f

Please sign in to comment.