【问题标题】:ESLint plugin that checks if test folder structure is mirroring source folder structureESLint plugin that checks if test folder structure is mirroring source folder structure
【发布时间】:2022-12-19 10:06:12
【问题描述】:

I'm looking for an ESLint plugin that can do the following.

I have the followingunit test files:

/root/test/drawing/line.test.ts
/root/test/drawing/circle.test.ts
/root/test/text/document.test.ts
/root/test/text/paragraph.test.ts

That test the followingsource files:

/root/src/drawing/line.ts
/root/src/drawing/circle.ts
/root/src/text/document.ts
/root/src/text/paragraph.ts

As you can see the test directory "mirrors" the src directory.

The plugin should report an error when there is a test file for which there is no corresponding file in the src directory.

This should prevent problems when files are moved around in the src folder and the test folder is not updated accordingly.

Does anybody know if such an ESLing plugin exists? I've been searching for a while and could only find plugins that enforce file and/or folder names.

【问题讨论】:

    标签: eslint eslint-plugin


    【解决方案1】:

    In case some wants to solve the same problem I created my own ESLint rule for this: https://www.npmjs.com/package/eslint-plugin-directory-mirror

    【讨论】:

      猜你喜欢
      • 2015-03-07
      • 2018-11-09
      • 2016-02-10
      • 2012-04-16
      • 1970-01-01
      • 2011-10-10
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多