@nitpicker/report-google-sheets 0.4.1 → 0.4.3
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.
- package/package.json +7 -4
- package/CHANGELOG.md +0 -8
- package/src/__tests__/api/create-sheets.api.ts +0 -234
- package/src/__tests__/api/helpers.ts +0 -148
- package/src/__tests__/api/sheets.api.ts +0 -217
- package/src/archive.ts +0 -29
- package/src/data/add-to-summary.ts +0 -10
- package/src/data/create-discrepancies.ts +0 -81
- package/src/data/create-image-list.ts +0 -74
- package/src/data/create-links.ts +0 -134
- package/src/data/create-page-list.ts +0 -472
- package/src/data/create-referrers-relational-table.ts +0 -115
- package/src/data/create-resources-relational-table.ts +0 -104
- package/src/data/create-resources.ts +0 -51
- package/src/data/create-violations.spec.ts +0 -95
- package/src/data/create-violations.ts +0 -47
- package/src/debug.ts +0 -7
- package/src/index.ts +0 -1
- package/src/load-config.spec.ts +0 -37
- package/src/load-config.ts +0 -17
- package/src/report.ts +0 -231
- package/src/reports/get-plugin-reports.spec.ts +0 -42
- package/src/reports/get-plugin-reports.ts +0 -24
- package/src/sheets/create-cell-data.ts +0 -1
- package/src/sheets/create-sheets.ts +0 -523
- package/src/sheets/default-cell-format.spec.ts +0 -13
- package/src/sheets/default-cell-format.ts +0 -8
- package/src/sheets/format.spec.ts +0 -17
- package/src/sheets/format.ts +0 -14
- package/src/sheets/types.ts +0 -106
- package/src/types.ts +0 -11
- package/src/utils/has-prop-filter.spec.ts +0 -25
- package/src/utils/has-prop-filter.ts +0 -21
- package/src/utils/non-null-filter.spec.ts +0 -27
- package/src/utils/non-null-filter.ts +0 -15
- package/tsconfig.json +0 -11
- package/tsconfig.tsbuildinfo +0 -1
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { describe, it, expect } from 'vitest';
|
|
2
|
-
|
|
3
|
-
import { hasPropFilter } from './has-prop-filter.js';
|
|
4
|
-
|
|
5
|
-
describe('hasPropFilter', () => {
|
|
6
|
-
it('returns true when property is defined and truthy', () => {
|
|
7
|
-
const filter = hasPropFilter<{ a?: string }, 'a'>('a');
|
|
8
|
-
expect(filter({ a: 'hello' })).toBe(true);
|
|
9
|
-
});
|
|
10
|
-
|
|
11
|
-
it('returns false when property is undefined', () => {
|
|
12
|
-
const filter = hasPropFilter<{ a?: string }, 'a'>('a');
|
|
13
|
-
expect(filter({ a: undefined })).toBe(false);
|
|
14
|
-
});
|
|
15
|
-
|
|
16
|
-
it('returns false when property is empty string', () => {
|
|
17
|
-
const filter = hasPropFilter<{ a?: string }, 'a'>('a');
|
|
18
|
-
expect(filter({ a: '' })).toBe(false);
|
|
19
|
-
});
|
|
20
|
-
|
|
21
|
-
it('returns true when property is a function', () => {
|
|
22
|
-
const filter = hasPropFilter<{ fn?: () => void }, 'fn'>('fn');
|
|
23
|
-
expect(filter({ fn: () => {} })).toBe(true);
|
|
24
|
-
});
|
|
25
|
-
});
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import type { RequiredProp } from '../types.js';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Returns a type guard that checks whether a specific property
|
|
5
|
-
* is defined (truthy) on an object. The returned guard narrows
|
|
6
|
-
* the type to `RequiredProp<T, P>`, making the property non-optional.
|
|
7
|
-
*
|
|
8
|
-
* Used to split `CreateSheetSetting[]` into subsets that definitely
|
|
9
|
-
* have a particular callback (e.g. `eachPage`, `eachResource`),
|
|
10
|
-
* eliminating the need for null-checks in the processing loops.
|
|
11
|
-
* @param prop - The property name to check.
|
|
12
|
-
* @returns A type-narrowing predicate function.
|
|
13
|
-
* @example
|
|
14
|
-
* ```ts
|
|
15
|
-
* const withEachPage = settings.filter(hasPropFilter('eachPage'));
|
|
16
|
-
* // withEachPage[0].eachPage is now non-optional
|
|
17
|
-
* ```
|
|
18
|
-
*/
|
|
19
|
-
export function hasPropFilter<T, P extends keyof T>(prop: P) {
|
|
20
|
-
return (object: T): object is RequiredProp<T, P> => !!object[prop];
|
|
21
|
-
}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import { describe, it, expect } from 'vitest';
|
|
2
|
-
|
|
3
|
-
import { nonNullFilter } from './non-null-filter.js';
|
|
4
|
-
|
|
5
|
-
describe('nonNullFilter', () => {
|
|
6
|
-
it('returns true for non-null values', () => {
|
|
7
|
-
expect(nonNullFilter(0)).toBe(true);
|
|
8
|
-
expect(nonNullFilter('')).toBe(true);
|
|
9
|
-
expect(nonNullFilter(false)).toBe(true);
|
|
10
|
-
expect(nonNullFilter('hello')).toBe(true);
|
|
11
|
-
expect(nonNullFilter(42)).toBe(true);
|
|
12
|
-
});
|
|
13
|
-
|
|
14
|
-
it('returns false for null', () => {
|
|
15
|
-
expect(nonNullFilter(null)).toBe(false);
|
|
16
|
-
});
|
|
17
|
-
|
|
18
|
-
it('returns false for undefined', () => {
|
|
19
|
-
expect(nonNullFilter()).toBe(false);
|
|
20
|
-
});
|
|
21
|
-
|
|
22
|
-
it('works as array filter to remove nulls', () => {
|
|
23
|
-
const items = [1, null, 2, undefined, 3];
|
|
24
|
-
const filtered = items.filter(nonNullFilter);
|
|
25
|
-
expect(filtered).toEqual([1, 2, 3]);
|
|
26
|
-
});
|
|
27
|
-
});
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Type guard that filters out `null` and `undefined` values.
|
|
3
|
-
* Commonly used with `Array.prototype.filter()` to narrow the
|
|
4
|
-
* element type after a `.map()` that may produce nulls.
|
|
5
|
-
* @param item - The value to check.
|
|
6
|
-
* @returns `true` if the item is neither `null` nor `undefined`.
|
|
7
|
-
* @example
|
|
8
|
-
* ```ts
|
|
9
|
-
* const items = [1, null, 2, undefined, 3].filter(nonNullFilter);
|
|
10
|
-
* // items: number[]
|
|
11
|
-
* ```
|
|
12
|
-
*/
|
|
13
|
-
export function nonNullFilter<T>(item: T): item is NonNullable<T> {
|
|
14
|
-
return item != null;
|
|
15
|
-
}
|
package/tsconfig.json
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"extends": "../../../tsconfig.json",
|
|
3
|
-
"compilerOptions": {
|
|
4
|
-
"composite": true,
|
|
5
|
-
"outDir": "./lib",
|
|
6
|
-
"rootDir": "./src"
|
|
7
|
-
},
|
|
8
|
-
"references": [{ "path": "../types" }, { "path": "../crawler" }],
|
|
9
|
-
"include": ["./src/**/*"],
|
|
10
|
-
"exclude": ["node_modules", "lib", "./src/**/*.spec.ts", "./src/__tests__/**/*"]
|
|
11
|
-
}
|