@servicetitan/folder-lint 29.0.0 → 30.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- {"version":3,"file":"namingConvention.d.ts","sourceRoot":"","sources":["../src/namingConvention.ts"],"names":[],"mappings":"AAAA,oBAAY,gBAAgB;IACxB,sBAAsB,6BAA6B;IACnD,SAAS,cAAc;CAC1B;AAGD,yBAAiB,gBAAgB,CAAC;IAC9B,SAAgB,KAAK,CAAC,IAAI,EAAE,gBAAgB,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAOnE;CACJ"}
1
+ {"version":3,"file":"namingConvention.d.ts","sourceRoot":"","sources":["../src/namingConvention.ts"],"names":[],"mappings":"AAAA,oBAAY,gBAAgB;IACxB,sBAAsB,6BAA6B;IACnD,SAAS,cAAc;CAC1B;AAGD,yBAAiB,gBAAgB,CAAC;IAC9B,SAAgB,KAAK,CAAC,IAAI,EAAE,gBAAgB,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAUnE;CACJ"}
@@ -9,6 +9,9 @@ var NamingConvention;
9
9
  // eslint-disable-next-line @typescript-eslint/no-namespace
10
10
  (function (NamingConvention) {
11
11
  function check(conv, name) {
12
+ if (name === '') {
13
+ return true;
14
+ }
12
15
  switch (conv) {
13
16
  case NamingConvention.DashDelimitedLowercase:
14
17
  return /^[a-z0-9_]+(-[a-z0-9_]+)*$/.test(name);
@@ -1 +1 @@
1
- {"version":3,"file":"namingConvention.js","sourceRoot":"","sources":["../src/namingConvention.ts"],"names":[],"mappings":";;;AAAA,IAAY,gBAGX;AAHD,WAAY,gBAAgB;IACxB,uEAAmD,CAAA;IACnD,2CAAuB,CAAA;AAC3B,CAAC,EAHW,gBAAgB,gCAAhB,gBAAgB,QAG3B;AAED,2DAA2D;AAC3D,WAAiB,gBAAgB;IAC7B,SAAgB,KAAK,CAAC,IAAsB,EAAE,IAAY;QACtD,QAAQ,IAAI,EAAE,CAAC;YACX,KAAK,gBAAgB,CAAC,sBAAsB;gBACxC,OAAO,4BAA4B,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;YACnD,KAAK,gBAAgB,CAAC,SAAS;gBAC3B,OAAO,uBAAuB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAClD,CAAC;IACL,CAAC;IAPe,sBAAK,QAOpB,CAAA;AACL,CAAC,EATgB,gBAAgB,gCAAhB,gBAAgB,QAShC"}
1
+ {"version":3,"file":"namingConvention.js","sourceRoot":"","sources":["../src/namingConvention.ts"],"names":[],"mappings":";;;AAAA,IAAY,gBAGX;AAHD,WAAY,gBAAgB;IACxB,uEAAmD,CAAA;IACnD,2CAAuB,CAAA;AAC3B,CAAC,EAHW,gBAAgB,gCAAhB,gBAAgB,QAG3B;AAED,2DAA2D;AAC3D,WAAiB,gBAAgB;IAC7B,SAAgB,KAAK,CAAC,IAAsB,EAAE,IAAY;QACtD,IAAI,IAAI,KAAK,EAAE,EAAE,CAAC;YACd,OAAO,IAAI,CAAC;QAChB,CAAC;QACD,QAAQ,IAAI,EAAE,CAAC;YACX,KAAK,gBAAgB,CAAC,sBAAsB;gBACxC,OAAO,4BAA4B,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;YACnD,KAAK,gBAAgB,CAAC,SAAS;gBAC3B,OAAO,uBAAuB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAClD,CAAC;IACL,CAAC;IAVe,sBAAK,QAUpB,CAAA;AACL,CAAC,EAZgB,gBAAgB,gCAAhB,gBAAgB,QAYhC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@servicetitan/folder-lint",
3
- "version": "29.0.0",
3
+ "version": "30.0.0",
4
4
  "description": "",
5
5
  "homepage": "https://docs.st.dev/docs/frontend/folder-schema",
6
6
  "repository": {
@@ -28,5 +28,5 @@
28
28
  "cli": {
29
29
  "webpack": false
30
30
  },
31
- "gitHead": "67b2763ad7c21532ea47c920974f87e8de433d32"
31
+ "gitHead": "e182cbb85cf66d62f235a9ca172fc04dc705fd0a"
32
32
  }
@@ -162,7 +162,7 @@ describe('sort with compareByMagicInName', () => {
162
162
  [{ name: '*' }, { name: 'index.@(tsx|ejs)' }, { name: 'awesome.ts' }],
163
163
  [{ name: 'awesome.ts' }, { name: '*' }, { name: 'index.@(tsx|ejs)' }],
164
164
  ],
165
- ])('%j -> %j', (strings, exp) => expect(strings.sort(compareByMagicInName)).toEqual(exp));
165
+ ])('%j -> %j', (strings, exp) => expect([...strings].sort(compareByMagicInName)).toEqual(exp));
166
166
  });
167
167
 
168
168
  describe('canonicalizeAllowedFiles', () => {
@@ -432,6 +432,7 @@ describe('checkPath', () => {
432
432
  ['index.tsx', []],
433
433
  ['/index.tsx', []],
434
434
  ['index.ts', ['allowedFilesFailure']],
435
+ ['.index.ts', ['allowedFilesFailure']],
435
436
  ['awesome.tsx', ['allowedFilesFailure']],
436
437
  [
437
438
  'awesome-file',
@@ -470,18 +471,9 @@ describe('checkPath', () => {
470
471
  ['awesome\\components\\awesome.tsx', []],
471
472
  ['\\awesome\\components\\awesome.tsx', []],
472
473
 
473
- [
474
- '',
475
- ['allowedFilesFailure', 'allowedExtensionsFailure', 'fileNamingConventionFailure'],
476
- ],
477
- [
478
- '/',
479
- ['allowedFilesFailure', 'allowedExtensionsFailure', 'fileNamingConventionFailure'],
480
- ],
481
- [
482
- '\\',
483
- ['allowedFilesFailure', 'allowedExtensionsFailure', 'fileNamingConventionFailure'],
484
- ],
474
+ ['', ['allowedFilesFailure', 'allowedExtensionsFailure']],
475
+ ['/', ['allowedFilesFailure', 'allowedExtensionsFailure']],
476
+ ['\\', ['allowedFilesFailure', 'allowedExtensionsFailure']],
485
477
  ['\\awesome/index.ts', []],
486
478
  ['//awesome///index.ts', []],
487
479
  ];
@@ -519,11 +511,11 @@ describe('checkPath', () => {
519
511
  test.each(cases)('%p -> %p', (path, expected) => expectFailures(check(path), expected));
520
512
 
521
513
  it('should not execute the recursive config more than once per level plus one', () => {
522
- expect(recursiveConfigMock).toBeCalledTimes(7);
514
+ expect(recursiveConfigMock).toHaveBeenCalledTimes(7);
523
515
  });
524
516
  });
525
517
  });
526
518
 
527
519
  function expectFailures(actual: Failure[], expected: string[]) {
528
- expect(actual.map(f => f.type).sort()).toEqual(expected.sort());
520
+ expect([...actual.map(f => f.type)].sort()).toEqual([...expected].sort());
529
521
  }
@@ -7,6 +7,8 @@ describe(NamingConvention.DashDelimitedLowercase, () => {
7
7
 
8
8
  // [fileName: string, isValid: boolean][]
9
9
  test.each([
10
+ ['', true],
11
+
10
12
  ['kebab', true],
11
13
  ['Kebab', false],
12
14
 
@@ -41,6 +43,8 @@ describe(NamingConvention.CamelCase, () => {
41
43
 
42
44
  // [fileName: string, isValid: boolean][]
43
45
  test.each([
46
+ ['', true],
47
+
44
48
  ['camel', true],
45
49
  ['Pascal', false],
46
50
 
@@ -6,6 +6,9 @@ export enum NamingConvention {
6
6
  // eslint-disable-next-line @typescript-eslint/no-namespace
7
7
  export namespace NamingConvention {
8
8
  export function check(conv: NamingConvention, name: string): boolean {
9
+ if (name === '') {
10
+ return true;
11
+ }
9
12
  switch (conv) {
10
13
  case NamingConvention.DashDelimitedLowercase:
11
14
  return /^[a-z0-9_]+(-[a-z0-9_]+)*$/.test(name);