public icon indicating copy to clipboard operation
public copied to clipboard

Write wallaby config in alternative languages (e.g. TypeScript)

Open tonyxiao opened this issue 7 years ago • 8 comments

Is it possible to write wallaby.js configuration in other languages such as TypeScript? Our entire codebase is in typescript and we try our best to keep it that way (so the compiler and linter and formatter can all do their job)

tonyxiao avatar Jan 19 '18 15:01 tonyxiao

Right now it's not possible, so adding the feature request label.

ArtemGovorov avatar Jan 20 '18 01:01 ArtemGovorov

I'm also interested in this feature; are there config types available we could use in the meantime via TSDoc?

marionebl avatar Oct 13 '21 01:10 marionebl

@marionebl Can you please share your Wallaby config? Right now no config types are available.

ArtemGovorov avatar Oct 13 '21 01:10 ArtemGovorov

I'd imagine something along the lines of

/**
 * @type {import('wallaby').Config}
 */
const config = {
  autoDetect: true,
  tests: [
    '**/*.test.ts',
    '**/*.test.tsx',
    { pattern: '**/__tests__/**', ignore: true }
  ],
};

module.exports = config;

Prior art for this is eslint:

/**
 * @type {import('eslint').Linter.Config}
 */
const config = {
  /* ... */
}

module.exports = config;

marionebl avatar Oct 13 '21 01:10 marionebl

@marionebl Thanks for sharing the config. We'll investigate adding config types.

Quick question: is the shared config just an example, or a real config?

/**
 * @type {import('wallaby').Config}
 */
const config = {
  autoDetect: true,
  tests: [
    '**/*.test.ts',
    '**/*.test.tsx',
    { pattern: '**/__tests__/**', ignore: true }
  ],
};

module.exports = config;

The reason I'm asking is because it seems like the config may not be required at all (if your Jest config already specifies the right test patterns).

ArtemGovorov avatar Oct 13 '21 01:10 ArtemGovorov

Quick question: is the shared config just an example, or a real config?

Thanks for checking in on it :) This is in fact a snippet of a real world config, but the real one is bigger - we need to define the patterns due to test files in __tests__ we know aren't compatible with wallaby.

marionebl avatar Oct 13 '21 01:10 marionebl

due to test files in __tests__ we know aren't compatible with wallaby

Interested to understand if these are jest tests and to know if there's a problem with Wallaby we should be looking at for you?

smcenlly avatar Oct 13 '21 03:10 smcenlly

Interested to understand if these are jest tests and to know if there's a problem with Wallaby we should be looking at for you?

No, those are playwright tests with a slightly different TypeScript setup - wouldn't expect Wallaby to support those.

marionebl avatar Oct 13 '21 03:10 marionebl