@typescript-eslint/utils 6.0.0-alpha.99 → 6.0.1-alpha.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.
- package/README.md +3 -1
- package/{_ts4.2 → _ts4.3}/dist/ast-utils/eslint-utils/ReferenceTracker.d.ts +2 -2
- package/{_ts4.2 → _ts4.3}/dist/ast-utils/eslint-utils/astUtilities.d.ts +3 -3
- package/{_ts4.2 → _ts4.3}/dist/ast-utils/eslint-utils/scopeAnalysis.d.ts +1 -1
- package/{_ts4.2 → _ts4.3}/dist/ast-utils/helpers.d.ts +3 -3
- package/{_ts4.2 → _ts4.3}/dist/ast-utils/predicates.d.ts +16 -16
- package/{_ts4.2 → _ts4.3}/dist/eslint-utils/RuleCreator.d.ts +2 -2
- package/{_ts4.2 → _ts4.3}/dist/eslint-utils/deepMerge.d.ts +1 -1
- package/_ts4.3/dist/eslint-utils/getParserServices.d.ts +24 -0
- package/{_ts4.2 → _ts4.3}/dist/eslint-utils/index.d.ts +0 -2
- package/_ts4.3/dist/json-schema.d.ts +392 -0
- package/{_ts4.2 → _ts4.3}/dist/ts-eslint/CLIEngine.d.ts +1 -1
- package/{_ts4.2 → _ts4.3}/dist/ts-eslint/ESLint.d.ts +3 -3
- package/{_ts4.2 → _ts4.3}/dist/ts-eslint/Linter.d.ts +22 -17
- package/{_ts4.2 → _ts4.3}/dist/ts-eslint/Rule.d.ts +20 -9
- package/{_ts4.2 → _ts4.3}/dist/ts-eslint/RuleTester.d.ts +5 -5
- package/{_ts4.2 → _ts4.3}/dist/ts-eslint/Scope.d.ts +1 -1
- package/{_ts4.2 → _ts4.3}/dist/ts-eslint/SourceCode.d.ts +3 -3
- package/dist/ast-utils/eslint-utils/PatternMatcher.d.ts.map +1 -1
- package/dist/ast-utils/eslint-utils/PatternMatcher.js.map +1 -1
- package/dist/ast-utils/eslint-utils/ReferenceTracker.d.ts +2 -2
- package/dist/ast-utils/eslint-utils/ReferenceTracker.d.ts.map +1 -1
- package/dist/ast-utils/eslint-utils/astUtilities.d.ts +3 -3
- package/dist/ast-utils/eslint-utils/astUtilities.d.ts.map +1 -1
- package/dist/ast-utils/eslint-utils/scopeAnalysis.d.ts +1 -1
- package/dist/ast-utils/eslint-utils/scopeAnalysis.d.ts.map +1 -1
- package/dist/ast-utils/helpers.d.ts +3 -3
- package/dist/ast-utils/predicates.d.ts +16 -16
- package/dist/ast-utils/predicates.d.ts.map +1 -1
- package/dist/eslint-utils/RuleCreator.d.ts +2 -2
- package/dist/eslint-utils/RuleCreator.d.ts.map +1 -1
- package/dist/eslint-utils/RuleCreator.js.map +1 -1
- package/dist/eslint-utils/deepMerge.d.ts +1 -1
- package/dist/eslint-utils/deepMerge.d.ts.map +1 -1
- package/dist/eslint-utils/deepMerge.js.map +1 -1
- package/dist/eslint-utils/getParserServices.d.ts +18 -3
- package/dist/eslint-utils/getParserServices.d.ts.map +1 -1
- package/dist/eslint-utils/getParserServices.js +1 -5
- package/dist/eslint-utils/getParserServices.js.map +1 -1
- package/dist/eslint-utils/index.d.ts +0 -2
- package/dist/eslint-utils/index.d.ts.map +1 -1
- package/dist/eslint-utils/index.js +0 -2
- package/dist/eslint-utils/index.js.map +1 -1
- package/dist/json-schema.d.ts +391 -1
- package/dist/json-schema.d.ts.map +1 -1
- package/dist/json-schema.js +6 -3
- package/dist/json-schema.js.map +1 -1
- package/dist/ts-eslint/CLIEngine.d.ts +1 -1
- package/dist/ts-eslint/CLIEngine.d.ts.map +1 -1
- package/dist/ts-eslint/ESLint.d.ts +3 -3
- package/dist/ts-eslint/ESLint.d.ts.map +1 -1
- package/dist/ts-eslint/Linter.d.ts +21 -17
- package/dist/ts-eslint/Linter.d.ts.map +1 -1
- package/dist/ts-eslint/Linter.js.map +1 -1
- package/dist/ts-eslint/Rule.d.ts +20 -9
- package/dist/ts-eslint/Rule.d.ts.map +1 -1
- package/dist/ts-eslint/RuleTester.d.ts +5 -5
- package/dist/ts-eslint/RuleTester.d.ts.map +1 -1
- package/dist/ts-eslint/RuleTester.js.map +1 -1
- package/dist/ts-eslint/Scope.d.ts +1 -1
- package/dist/ts-eslint/Scope.d.ts.map +1 -1
- package/dist/ts-eslint/Scope.js +1 -2
- package/dist/ts-eslint/Scope.js.map +1 -1
- package/dist/ts-eslint/SourceCode.d.ts +3 -3
- package/dist/ts-eslint/SourceCode.d.ts.map +1 -1
- package/package.json +14 -14
- package/_ts4.2/dist/eslint-utils/batchedSingleLineTests.d.ts +0 -24
- package/_ts4.2/dist/eslint-utils/getParserServices.d.ts +0 -9
- package/_ts4.2/dist/eslint-utils/rule-tester/RuleTester.d.ts +0 -49
- package/_ts4.2/dist/eslint-utils/rule-tester/dependencyConstraints.d.ts +0 -17
- package/_ts4.2/dist/json-schema.d.ts +0 -2
- package/dist/eslint-utils/batchedSingleLineTests.d.ts +0 -24
- package/dist/eslint-utils/batchedSingleLineTests.d.ts.map +0 -1
- package/dist/eslint-utils/batchedSingleLineTests.js +0 -36
- package/dist/eslint-utils/batchedSingleLineTests.js.map +0 -1
- package/dist/eslint-utils/rule-tester/RuleTester.d.ts +0 -49
- package/dist/eslint-utils/rule-tester/RuleTester.d.ts.map +0 -1
- package/dist/eslint-utils/rule-tester/RuleTester.js +0 -250
- package/dist/eslint-utils/rule-tester/RuleTester.js.map +0 -1
- package/dist/eslint-utils/rule-tester/dependencyConstraints.d.ts +0 -17
- package/dist/eslint-utils/rule-tester/dependencyConstraints.d.ts.map +0 -1
- package/dist/eslint-utils/rule-tester/dependencyConstraints.js +0 -53
- package/dist/eslint-utils/rule-tester/dependencyConstraints.js.map +0 -1
- /package/{_ts4.2 → _ts4.3}/dist/ast-utils/eslint-utils/PatternMatcher.d.ts +0 -0
- /package/{_ts4.2 → _ts4.3}/dist/ast-utils/eslint-utils/index.d.ts +0 -0
- /package/{_ts4.2 → _ts4.3}/dist/ast-utils/eslint-utils/predicates.d.ts +0 -0
- /package/{_ts4.2 → _ts4.3}/dist/ast-utils/index.d.ts +0 -0
- /package/{_ts4.2 → _ts4.3}/dist/ast-utils/misc.d.ts +0 -0
- /package/{_ts4.2 → _ts4.3}/dist/eslint-utils/InferTypesFromRule.d.ts +0 -0
- /package/{_ts4.2 → _ts4.3}/dist/eslint-utils/applyDefault.d.ts +0 -0
- /package/{_ts4.2 → _ts4.3}/dist/eslint-utils/nullThrows.d.ts +0 -0
- /package/{_ts4.2 → _ts4.3}/dist/index.d.ts +0 -0
- /package/{_ts4.2 → _ts4.3}/dist/ts-eslint/AST.d.ts +0 -0
- /package/{_ts4.2 → _ts4.3}/dist/ts-eslint/ParserOptions.d.ts +0 -0
- /package/{_ts4.2 → _ts4.3}/dist/ts-eslint/index.d.ts +0 -0
- /package/{_ts4.2 → _ts4.3}/dist/ts-estree.d.ts +0 -0
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import * as semver from 'semver';
|
|
2
|
-
interface SemverVersionConstraint {
|
|
3
|
-
readonly range: string;
|
|
4
|
-
readonly options?: Parameters<typeof semver.satisfies>[2];
|
|
5
|
-
}
|
|
6
|
-
type AtLeastVersionConstraint = `${number}` | `${number}.${number}` | `${number}.${number}.${number}` | `${number}.${number}.${number}-${string}`;
|
|
7
|
-
type VersionConstraint = SemverVersionConstraint | AtLeastVersionConstraint;
|
|
8
|
-
interface DependencyConstraint {
|
|
9
|
-
/**
|
|
10
|
-
* Passing a string for the value is shorthand for a '>=' constraint
|
|
11
|
-
*/
|
|
12
|
-
readonly [packageName: string]: VersionConstraint;
|
|
13
|
-
}
|
|
14
|
-
declare function satisfiesAllDependencyConstraints(dependencyConstraints: DependencyConstraint | undefined): boolean;
|
|
15
|
-
export { satisfiesAllDependencyConstraints };
|
|
16
|
-
export type { DependencyConstraint };
|
|
17
|
-
//# sourceMappingURL=dependencyConstraints.d.ts.map
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
export { JSONSchema4, JSONSchema4Type, JSONSchema4TypeName, JSONSchema4Version, JSONSchema6, JSONSchema6Definition, JSONSchema6Type, JSONSchema6TypeName, JSONSchema6Version, JSONSchema7, JSONSchema7Array, JSONSchema7Definition, JSONSchema7Type, JSONSchema7TypeName, JSONSchema7Version, ValidationError, ValidationResult, } from 'json-schema';
|
|
2
|
-
//# sourceMappingURL=json-schema.d.ts.map
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import type { InvalidTestCase, ValidTestCase } from '../eslint-utils/rule-tester/RuleTester';
|
|
2
|
-
/**
|
|
3
|
-
* Converts a batch of single line tests into a number of separate test cases.
|
|
4
|
-
* This makes it easier to write tests which use the same options.
|
|
5
|
-
*
|
|
6
|
-
* Why wouldn't you just leave them as one test?
|
|
7
|
-
* Because it makes the test error messages harder to decipher.
|
|
8
|
-
* This way each line will fail separately, instead of them all failing together.
|
|
9
|
-
*/
|
|
10
|
-
declare function batchedSingleLineTests<TOptions extends Readonly<unknown[]>>(test: ValidTestCase<TOptions>): ValidTestCase<TOptions>[];
|
|
11
|
-
/**
|
|
12
|
-
* Converts a batch of single line tests into a number of separate test cases.
|
|
13
|
-
* This makes it easier to write tests which use the same options.
|
|
14
|
-
*
|
|
15
|
-
* Why wouldn't you just leave them as one test?
|
|
16
|
-
* Because it makes the test error messages harder to decipher.
|
|
17
|
-
* This way each line will fail separately, instead of them all failing together.
|
|
18
|
-
*
|
|
19
|
-
* Make sure you have your line numbers correct for error reporting, as it will match
|
|
20
|
-
* the line numbers up with the split tests!
|
|
21
|
-
*/
|
|
22
|
-
declare function batchedSingleLineTests<TMessageIds extends string, TOptions extends Readonly<unknown[]>>(test: InvalidTestCase<TMessageIds, TOptions>): InvalidTestCase<TMessageIds, TOptions>[];
|
|
23
|
-
export { batchedSingleLineTests };
|
|
24
|
-
//# sourceMappingURL=batchedSingleLineTests.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"batchedSingleLineTests.d.ts","sourceRoot":"","sources":["../../src/eslint-utils/batchedSingleLineTests.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,eAAe,EACf,aAAa,EACd,MAAM,wCAAwC,CAAC;AAEhD;;;;;;;GAOG;AACH,iBAAS,sBAAsB,CAAC,QAAQ,SAAS,QAAQ,CAAC,OAAO,EAAE,CAAC,EAClE,IAAI,EAAE,aAAa,CAAC,QAAQ,CAAC,GAC5B,aAAa,CAAC,QAAQ,CAAC,EAAE,CAAC;AAC7B;;;;;;;;;;GAUG;AACH,iBAAS,sBAAsB,CAC7B,WAAW,SAAS,MAAM,EAC1B,QAAQ,SAAS,QAAQ,CAAC,OAAO,EAAE,CAAC,EAEpC,IAAI,EAAE,eAAe,CAAC,WAAW,EAAE,QAAQ,CAAC,GAC3C,eAAe,CAAC,WAAW,EAAE,QAAQ,CAAC,EAAE,CAAC;AAwC5C,OAAO,EAAE,sBAAsB,EAAE,CAAC"}
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.batchedSingleLineTests = void 0;
|
|
4
|
-
function batchedSingleLineTests(options) {
|
|
5
|
-
// -- eslint counts lines from 1
|
|
6
|
-
const lineOffset = options.code.startsWith('\n') ? 2 : 1;
|
|
7
|
-
const output = 'output' in options && options.output
|
|
8
|
-
? options.output.trim().split('\n')
|
|
9
|
-
: null;
|
|
10
|
-
return options.code
|
|
11
|
-
.trim()
|
|
12
|
-
.split('\n')
|
|
13
|
-
.map((code, i) => {
|
|
14
|
-
const lineNum = i + lineOffset;
|
|
15
|
-
const errors = 'errors' in options
|
|
16
|
-
? options.errors.filter(e => e.line === lineNum)
|
|
17
|
-
: [];
|
|
18
|
-
const returnVal = {
|
|
19
|
-
...options,
|
|
20
|
-
code,
|
|
21
|
-
errors: errors.map(e => ({
|
|
22
|
-
...e,
|
|
23
|
-
line: 1,
|
|
24
|
-
})),
|
|
25
|
-
};
|
|
26
|
-
if (output?.[i]) {
|
|
27
|
-
return {
|
|
28
|
-
...returnVal,
|
|
29
|
-
output: output[i],
|
|
30
|
-
};
|
|
31
|
-
}
|
|
32
|
-
return returnVal;
|
|
33
|
-
});
|
|
34
|
-
}
|
|
35
|
-
exports.batchedSingleLineTests = batchedSingleLineTests;
|
|
36
|
-
//# sourceMappingURL=batchedSingleLineTests.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"batchedSingleLineTests.js","sourceRoot":"","sources":["../../src/eslint-utils/batchedSingleLineTests.ts"],"names":[],"mappings":";;;AAiCA,SAAS,sBAAsB,CAI7B,OAAyE;IAEzE,gCAAgC;IAChC,MAAM,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IACzD,MAAM,MAAM,GACV,QAAQ,IAAI,OAAO,IAAI,OAAO,CAAC,MAAM;QACnC,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC;QACnC,CAAC,CAAC,IAAI,CAAC;IACX,OAAO,OAAO,CAAC,IAAI;SAChB,IAAI,EAAE;SACN,KAAK,CAAC,IAAI,CAAC;SACX,GAAG,CAAC,CAAC,IAAI,EAAE,CAAC,EAAE,EAAE;QACf,MAAM,OAAO,GAAG,CAAC,GAAG,UAAU,CAAC;QAC/B,MAAM,MAAM,GACV,QAAQ,IAAI,OAAO;YACjB,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,OAAO,CAAC;YAChD,CAAC,CAAC,EAAE,CAAC;QACT,MAAM,SAAS,GAAG;YAChB,GAAG,OAAO;YACV,IAAI;YACJ,MAAM,EAAE,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;gBACvB,GAAG,CAAC;gBACJ,IAAI,EAAE,CAAC;aACR,CAAC,CAAC;SACJ,CAAC;QACF,IAAI,MAAM,EAAE,CAAC,CAAC,CAAC,EAAE;YACf,OAAO;gBACL,GAAG,SAAS;gBACZ,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;aAClB,CAAC;SACH;QACD,OAAO,SAAS,CAAC;IACnB,CAAC,CAAC,CAAC;AACP,CAAC;AAEQ,wDAAsB"}
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
import type { RuleModule } from '../../ts-eslint/Rule';
|
|
2
|
-
import * as BaseRuleTester from '../../ts-eslint/RuleTester';
|
|
3
|
-
import type { DependencyConstraint } from './dependencyConstraints';
|
|
4
|
-
declare const TS_ESLINT_PARSER = "@typescript-eslint/parser";
|
|
5
|
-
type RuleTesterConfig = Omit<BaseRuleTester.RuleTesterConfig, 'parser'> & {
|
|
6
|
-
parser: typeof TS_ESLINT_PARSER;
|
|
7
|
-
/**
|
|
8
|
-
* Constraints that must pass in the current environment for any tests to run
|
|
9
|
-
*/
|
|
10
|
-
dependencyConstraints?: DependencyConstraint;
|
|
11
|
-
};
|
|
12
|
-
interface InvalidTestCase<TMessageIds extends string, TOptions extends Readonly<unknown[]>> extends BaseRuleTester.InvalidTestCase<TMessageIds, TOptions> {
|
|
13
|
-
/**
|
|
14
|
-
* Constraints that must pass in the current environment for the test to run
|
|
15
|
-
*/
|
|
16
|
-
dependencyConstraints?: DependencyConstraint;
|
|
17
|
-
}
|
|
18
|
-
interface ValidTestCase<TOptions extends Readonly<unknown[]>> extends BaseRuleTester.ValidTestCase<TOptions> {
|
|
19
|
-
/**
|
|
20
|
-
* Constraints that must pass in the current environment for the test to run
|
|
21
|
-
*/
|
|
22
|
-
dependencyConstraints?: DependencyConstraint;
|
|
23
|
-
}
|
|
24
|
-
interface RunTests<TMessageIds extends string, TOptions extends Readonly<unknown[]>> {
|
|
25
|
-
readonly valid: readonly (ValidTestCase<TOptions> | string)[];
|
|
26
|
-
readonly invalid: readonly InvalidTestCase<TMessageIds, TOptions>[];
|
|
27
|
-
}
|
|
28
|
-
type AfterAll = (fn: () => void) => void;
|
|
29
|
-
declare class RuleTester extends BaseRuleTester.RuleTester {
|
|
30
|
-
#private;
|
|
31
|
-
/**
|
|
32
|
-
* If you supply a value to this property, the rule tester will call this instead of using the version defined on
|
|
33
|
-
* the global namespace.
|
|
34
|
-
*/
|
|
35
|
-
static get afterAll(): AfterAll;
|
|
36
|
-
static set afterAll(value: AfterAll | undefined);
|
|
37
|
-
private get staticThis();
|
|
38
|
-
constructor(baseOptions: RuleTesterConfig);
|
|
39
|
-
private getFilename;
|
|
40
|
-
run<TMessageIds extends string, TOptions extends Readonly<unknown[]>>(name: string, rule: RuleModule<TMessageIds, TOptions>, testsReadonly: RunTests<TMessageIds, TOptions>): void;
|
|
41
|
-
}
|
|
42
|
-
/**
|
|
43
|
-
* Simple no-op tag to mark code samples as "should not format with prettier"
|
|
44
|
-
* for the internal/plugin-test-formatting lint rule
|
|
45
|
-
*/
|
|
46
|
-
declare function noFormat(raw: TemplateStringsArray, ...keys: string[]): string;
|
|
47
|
-
export { noFormat, RuleTester };
|
|
48
|
-
export type { InvalidTestCase, ValidTestCase, RunTests };
|
|
49
|
-
//# sourceMappingURL=RuleTester.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"RuleTester.d.ts","sourceRoot":"","sources":["../../../src/eslint-utils/rule-tester/RuleTester.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAEvD,OAAO,KAAK,cAAc,MAAM,4BAA4B,CAAC;AAE7D,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAC;AAGpE,QAAA,MAAM,gBAAgB,8BAA8B,CAAC;AAGrD,KAAK,gBAAgB,GAAG,IAAI,CAAC,cAAc,CAAC,gBAAgB,EAAE,QAAQ,CAAC,GAAG;IACxE,MAAM,EAAE,OAAO,gBAAgB,CAAC;IAChC;;OAEG;IACH,qBAAqB,CAAC,EAAE,oBAAoB,CAAC;CAC9C,CAAC;AAEF,UAAU,eA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,IAAI;CA6JR;AAED;;;GAGG;AACH,iBAAS,QAAQ,CAAC,GAAG,EAAE,oBAAoB,EAAE,GAAG,IAAI,EAAE,MAAM,EAAE,GAAG,MAAM,CAEtE;AAED,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,CAAC;AAChC,YAAY,EAAE,eAAe,EAAE,aAAa,EAAE,QAAQ,EAAE,CAAC"}
|
|
@@ -1,250 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
|
-
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
26
|
-
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
27
|
-
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
28
|
-
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
29
|
-
};
|
|
30
|
-
var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
|
31
|
-
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
32
|
-
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
33
|
-
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
34
|
-
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
35
|
-
};
|
|
36
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
37
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
38
|
-
};
|
|
39
|
-
var _a, _RuleTester_baseOptions, _RuleTester_afterAll;
|
|
40
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
41
|
-
exports.RuleTester = exports.noFormat = void 0;
|
|
42
|
-
const assert_1 = __importDefault(require("assert"));
|
|
43
|
-
const package_json_1 = require("eslint/package.json");
|
|
44
|
-
const path = __importStar(require("path"));
|
|
45
|
-
const semver = __importStar(require("semver"));
|
|
46
|
-
const BaseRuleTester = __importStar(require("../../ts-eslint/RuleTester"));
|
|
47
|
-
const deepMerge_1 = require("../deepMerge");
|
|
48
|
-
const dependencyConstraints_1 = require("./dependencyConstraints");
|
|
49
|
-
const TS_ESLINT_PARSER = '@typescript-eslint/parser';
|
|
50
|
-
const ERROR_MESSAGE = `Do not set the parser at the test level unless you want to use a parser other than ${TS_ESLINT_PARSER}`;
|
|
51
|
-
function isDescribeWithSkip(value) {
|
|
52
|
-
return (typeof value === 'object' &&
|
|
53
|
-
value != null &&
|
|
54
|
-
'skip' in value &&
|
|
55
|
-
typeof value.skip === 'function');
|
|
56
|
-
}
|
|
57
|
-
class RuleTester extends BaseRuleTester.RuleTester {
|
|
58
|
-
/**
|
|
59
|
-
* If you supply a value to this property, the rule tester will call this instead of using the version defined on
|
|
60
|
-
* the global namespace.
|
|
61
|
-
*/
|
|
62
|
-
static get afterAll() {
|
|
63
|
-
return (__classPrivateFieldGet(this, _a, "f", _RuleTester_afterAll) ??
|
|
64
|
-
(typeof afterAll === 'function' ? afterAll : () => { }));
|
|
65
|
-
}
|
|
66
|
-
static set afterAll(value) {
|
|
67
|
-
__classPrivateFieldSet(this, _a, value, "f", _RuleTester_afterAll);
|
|
68
|
-
}
|
|
69
|
-
get staticThis() {
|
|
70
|
-
// the cast here is due to https://github.com/microsoft/TypeScript/issues/3841
|
|
71
|
-
return this.constructor;
|
|
72
|
-
}
|
|
73
|
-
constructor(baseOptions) {
|
|
74
|
-
// eslint will hard-error if you include non-standard top-level properties
|
|
75
|
-
const { dependencyConstraints: _, ...baseOptionsSafeForESLint } = baseOptions;
|
|
76
|
-
super({
|
|
77
|
-
...baseOptionsSafeForESLint,
|
|
78
|
-
parserOptions: {
|
|
79
|
-
...baseOptions.parserOptions,
|
|
80
|
-
warnOnUnsupportedTypeScriptVersion: baseOptions.parserOptions?.warnOnUnsupportedTypeScriptVersion ??
|
|
81
|
-
false,
|
|
82
|
-
},
|
|
83
|
-
// as of eslint 6 you have to provide an absolute path to the parser
|
|
84
|
-
// but that's not as clean to type, this saves us trying to manually enforce
|
|
85
|
-
// that contributors require.resolve everything
|
|
86
|
-
parser: require.resolve(baseOptions.parser),
|
|
87
|
-
});
|
|
88
|
-
_RuleTester_baseOptions.set(this, void 0);
|
|
89
|
-
__classPrivateFieldSet(this, _RuleTester_baseOptions, baseOptions, "f");
|
|
90
|
-
// make sure that the parser doesn't hold onto file handles between tests
|
|
91
|
-
// on linux (i.e. our CI env), there can be very a limited number of watch handles available
|
|
92
|
-
this.staticThis.afterAll(() => {
|
|
93
|
-
try {
|
|
94
|
-
// instead of creating a hard dependency, just use a soft require
|
|
95
|
-
// a bit weird, but if they're using this tooling, it'll be installed
|
|
96
|
-
const parser = require(TS_ESLINT_PARSER);
|
|
97
|
-
parser.clearCaches();
|
|
98
|
-
}
|
|
99
|
-
catch {
|
|
100
|
-
// ignored on purpose
|
|
101
|
-
}
|
|
102
|
-
});
|
|
103
|
-
}
|
|
104
|
-
getFilename(testOptions) {
|
|
105
|
-
const resolvedOptions = (0, deepMerge_1.deepMerge)(__classPrivateFieldGet(this, _RuleTester_baseOptions, "f").parserOptions, testOptions);
|
|
106
|
-
const filename = `file.ts${resolvedOptions.ecmaFeatures?.jsx ? 'x' : ''}`;
|
|
107
|
-
if (resolvedOptions.project) {
|
|
108
|
-
return path.join(resolvedOptions.tsconfigRootDir != null
|
|
109
|
-
? resolvedOptions.tsconfigRootDir
|
|
110
|
-
: process.cwd(), filename);
|
|
111
|
-
}
|
|
112
|
-
return filename;
|
|
113
|
-
}
|
|
114
|
-
// as of eslint 6 you have to provide an absolute path to the parser
|
|
115
|
-
// If you don't do that at the test level, the test will fail somewhat cryptically...
|
|
116
|
-
// This is a lot more explicit
|
|
117
|
-
run(name, rule, testsReadonly) {
|
|
118
|
-
if (__classPrivateFieldGet(this, _RuleTester_baseOptions, "f").dependencyConstraints &&
|
|
119
|
-
!(0, dependencyConstraints_1.satisfiesAllDependencyConstraints)(__classPrivateFieldGet(this, _RuleTester_baseOptions, "f").dependencyConstraints)) {
|
|
120
|
-
if (isDescribeWithSkip(this.staticThis.describe)) {
|
|
121
|
-
// for frameworks like mocha or jest that have a "skip" version of their function
|
|
122
|
-
// we can provide a nice skipped test!
|
|
123
|
-
this.staticThis.describe.skip(name, () => {
|
|
124
|
-
this.staticThis.it('All tests skipped due to unsatisfied constructor dependency constraints', () => { });
|
|
125
|
-
});
|
|
126
|
-
}
|
|
127
|
-
else {
|
|
128
|
-
// otherwise just declare an empty test
|
|
129
|
-
this.staticThis.describe(name, () => {
|
|
130
|
-
this.staticThis.it('All tests skipped due to unsatisfied constructor dependency constraints', () => {
|
|
131
|
-
// some frameworks error if there are no assertions
|
|
132
|
-
assert_1.default.equal(true, true);
|
|
133
|
-
});
|
|
134
|
-
});
|
|
135
|
-
}
|
|
136
|
-
// don't run any tests because we don't match the base constraint
|
|
137
|
-
return;
|
|
138
|
-
}
|
|
139
|
-
const tests = {
|
|
140
|
-
// standardize the valid tests as objects
|
|
141
|
-
valid: testsReadonly.valid.map(test => {
|
|
142
|
-
if (typeof test === 'string') {
|
|
143
|
-
return {
|
|
144
|
-
code: test,
|
|
145
|
-
};
|
|
146
|
-
}
|
|
147
|
-
return test;
|
|
148
|
-
}),
|
|
149
|
-
invalid: testsReadonly.invalid,
|
|
150
|
-
};
|
|
151
|
-
// convenience iterator to make it easy to loop all tests without a concat
|
|
152
|
-
const allTestsIterator = {
|
|
153
|
-
*[Symbol.iterator]() {
|
|
154
|
-
for (const test of tests.valid) {
|
|
155
|
-
yield test;
|
|
156
|
-
}
|
|
157
|
-
for (const test of tests.invalid) {
|
|
158
|
-
yield test;
|
|
159
|
-
}
|
|
160
|
-
},
|
|
161
|
-
};
|
|
162
|
-
/*
|
|
163
|
-
Automatically add a filename to the tests to enable type-aware tests to "just work".
|
|
164
|
-
This saves users having to verbosely and manually add the filename to every
|
|
165
|
-
single test case.
|
|
166
|
-
Hugely helps with the string-based valid test cases as it means they don't
|
|
167
|
-
need to be made objects!
|
|
168
|
-
Also removes dependencyConstraints, which we support but ESLint core doesn't.
|
|
169
|
-
*/
|
|
170
|
-
const normalizeTest = ({ dependencyConstraints: _, ...test }) => {
|
|
171
|
-
if (test.parser === TS_ESLINT_PARSER) {
|
|
172
|
-
throw new Error(ERROR_MESSAGE);
|
|
173
|
-
}
|
|
174
|
-
if (!test.filename) {
|
|
175
|
-
return {
|
|
176
|
-
...test,
|
|
177
|
-
filename: this.getFilename(test.parserOptions),
|
|
178
|
-
};
|
|
179
|
-
}
|
|
180
|
-
return test;
|
|
181
|
-
};
|
|
182
|
-
tests.valid = tests.valid.map(normalizeTest);
|
|
183
|
-
tests.invalid = tests.invalid.map(normalizeTest);
|
|
184
|
-
const hasOnly = (() => {
|
|
185
|
-
for (const test of allTestsIterator) {
|
|
186
|
-
if (test.only) {
|
|
187
|
-
return true;
|
|
188
|
-
}
|
|
189
|
-
}
|
|
190
|
-
return false;
|
|
191
|
-
})();
|
|
192
|
-
// if there is an `only: true` - don't apply constraints - assume that
|
|
193
|
-
// we are in "local development" mode rather than "CI validation" mode
|
|
194
|
-
if (!hasOnly) {
|
|
195
|
-
/*
|
|
196
|
-
Automatically skip tests that don't satisfy the dependency constraints.
|
|
197
|
-
*/
|
|
198
|
-
const hasConstraints = (() => {
|
|
199
|
-
for (const test of allTestsIterator) {
|
|
200
|
-
if (test.dependencyConstraints &&
|
|
201
|
-
Object.keys(test.dependencyConstraints).length > 0) {
|
|
202
|
-
return true;
|
|
203
|
-
}
|
|
204
|
-
}
|
|
205
|
-
return false;
|
|
206
|
-
})();
|
|
207
|
-
if (hasConstraints) {
|
|
208
|
-
// The `only: boolean` test property was only added in ESLint v7.29.0.
|
|
209
|
-
if (semver.satisfies(package_json_1.version, '>=7.29.0')) {
|
|
210
|
-
/*
|
|
211
|
-
Mark all satisfactory tests as `only: true`, and all other tests as
|
|
212
|
-
`only: false`.
|
|
213
|
-
When multiple tests are marked as "only", test frameworks like jest and mocha
|
|
214
|
-
will run all of those tests and will just skip the other tests.
|
|
215
|
-
|
|
216
|
-
We do this instead of just omitting the tests entirely because it gives the
|
|
217
|
-
test framework the opportunity to log the test as skipped rather than the test
|
|
218
|
-
just disappearing.
|
|
219
|
-
*/
|
|
220
|
-
const maybeMarkAsOnly = (test) => {
|
|
221
|
-
return {
|
|
222
|
-
...test,
|
|
223
|
-
only: (0, dependencyConstraints_1.satisfiesAllDependencyConstraints)(test.dependencyConstraints),
|
|
224
|
-
};
|
|
225
|
-
};
|
|
226
|
-
tests.valid = tests.valid.map(maybeMarkAsOnly);
|
|
227
|
-
tests.invalid = tests.invalid.map(maybeMarkAsOnly);
|
|
228
|
-
}
|
|
229
|
-
else {
|
|
230
|
-
// On older versions we just fallback to raw array filtering like SAVAGES
|
|
231
|
-
tests.valid = tests.valid.filter(test => (0, dependencyConstraints_1.satisfiesAllDependencyConstraints)(test.dependencyConstraints));
|
|
232
|
-
tests.invalid = tests.invalid.filter(test => (0, dependencyConstraints_1.satisfiesAllDependencyConstraints)(test.dependencyConstraints));
|
|
233
|
-
}
|
|
234
|
-
}
|
|
235
|
-
}
|
|
236
|
-
super.run(name, rule, tests);
|
|
237
|
-
}
|
|
238
|
-
}
|
|
239
|
-
exports.RuleTester = RuleTester;
|
|
240
|
-
_a = RuleTester, _RuleTester_baseOptions = new WeakMap();
|
|
241
|
-
_RuleTester_afterAll = { value: void 0 };
|
|
242
|
-
/**
|
|
243
|
-
* Simple no-op tag to mark code samples as "should not format with prettier"
|
|
244
|
-
* for the internal/plugin-test-formatting lint rule
|
|
245
|
-
*/
|
|
246
|
-
function noFormat(raw, ...keys) {
|
|
247
|
-
return String.raw({ raw }, ...keys);
|
|
248
|
-
}
|
|
249
|
-
exports.noFormat = noFormat;
|
|
250
|
-
//# sourceMappingURL=RuleTester.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"RuleTester.js","sourceRoot":"","sources":["../../../src/eslint-utils/rule-tester/RuleTester.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,oDAA4B;AAC5B,sDAA+D;AAC/D,2CAA6B;AAC7B,+CAAiC;AAKjC,2EAA6D;AAC7D,4CAAyC;AAEzC,mEAA4E;AAE5E,MAAM,gBAAgB,GAAG,2BAA2B,CAAC;AACrD,MAAM,aAAa,GAAG,sFAAsF,gBAAgB,EAAE,CAAC;AAqC/H,SAAS,kBAAkB,CACzB,KAAc;IAId,OAAO,CACL,OAAO,KAAK,KAAK,QAAQ;QACzB,KAAK,IAAI,IAAI;QACb,MAAM,IAAI,KAAK;QACf,OAAQ,KAAiC,CAAC,IA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,CACtC,IAAA,yDAAiC,EAAC,IAAI,CAAC,qBAAqB,CAAC,CAC9D,CAAC;oBACF,KAAK,CAAC,OAAO,GAAG,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,CAC1C,IAAA,yDAAiC,EAAC,IAAI,CAAC,qBAAqB,CAAC,CAC9D,CAAC;iBACH;aACF;SACF;QAED,KAAK,CAAC,GAAG,CAAC,IAAI,EAAE,IAAI,EAAE,KAAK,CAAC,CAAC;IAC/B,CAAC;CACF;AAUkB,gCAAU;;AApPpB,wCAAS,CAAuB;AA4OzC;;;GAGG;AACH,SAAS,QAAQ,CAAC,GAAyB,EAAE,GAAG,IAAc;IAC5D,OAAO,MAAM,CAAC,GAAG,CAAC,EAAE,GAAG,EAAE,EAAE,GAAG,IAAI,CAAC,CAAC;AACtC,CAAC;AAEQ,4BAAQ"}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import * as semver from 'semver';
|
|
2
|
-
interface SemverVersionConstraint {
|
|
3
|
-
readonly range: string;
|
|
4
|
-
readonly options?: Parameters<typeof semver.satisfies>[2];
|
|
5
|
-
}
|
|
6
|
-
type AtLeastVersionConstraint = `${number}` | `${number}.${number}` | `${number}.${number}.${number}` | `${number}.${number}.${number}-${string}`;
|
|
7
|
-
type VersionConstraint = SemverVersionConstraint | AtLeastVersionConstraint;
|
|
8
|
-
interface DependencyConstraint {
|
|
9
|
-
/**
|
|
10
|
-
* Passing a string for the value is shorthand for a '>=' constraint
|
|
11
|
-
*/
|
|
12
|
-
readonly [packageName: string]: VersionConstraint;
|
|
13
|
-
}
|
|
14
|
-
declare function satisfiesAllDependencyConstraints(dependencyConstraints: DependencyConstraint | undefined): boolean;
|
|
15
|
-
export { satisfiesAllDependencyConstraints };
|
|
16
|
-
export type { DependencyConstraint };
|
|
17
|
-
//# sourceMappingURL=dependencyConstraints.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"dependencyConstraints.d.ts","sourceRoot":"","sources":["../../../src/eslint-utils/rule-tester/dependencyConstraints.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,QAAQ,CAAC;AAEjC,UAAU,uBAAuB;IAC/B,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,OAAO,CAAC,EAAE,UAAU,CAAC,OAAO,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC;CAC3D;AACD,KAAK,wBAAwB,GACzB,GAAG,MAAM,EAAE,GACX,GAAG,MAAM,IAAI,MAAM,EAAE,GACrB,GAAG,MAAM,IAAI,MAAM,IAAI,MAAM,EAAE,GAC/B,GAAG,MAAM,IAAI,MAAM,IAAI,MAAM,IAAI,MAAM,EAAE,CAAC;AAC9C,KAAK,iBAAiB,GAAG,uBAAuB,GAAG,wBAAwB,CAAC;AAC5E,UAAU,oBAAoB;IAC5B;;OAEG;IACH,QAAQ,EAAE,WAAW,EAAE,MAAM,GAAG,iBAAiB,CAAC;CACnD;AA0BD,iBAAS,iCAAiC,CACxC,qBAAqB,EAAE,oBAAoB,GAAG,SAAS,GACtD,OAAO,CAcT;AAED,OAAO,EAAE,iCAAiC,EAAE,CAAC;AAC7C,YAAY,EAAE,oBAAoB,EAAE,CAAC"}
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
-
exports.satisfiesAllDependencyConstraints = void 0;
|
|
27
|
-
const semver = __importStar(require("semver"));
|
|
28
|
-
const BASE_SATISFIES_OPTIONS = {
|
|
29
|
-
includePrerelease: true,
|
|
30
|
-
};
|
|
31
|
-
function satisfiesDependencyConstraint(packageName, constraintIn) {
|
|
32
|
-
const constraint = typeof constraintIn === 'string'
|
|
33
|
-
? {
|
|
34
|
-
range: `>=${constraintIn}`,
|
|
35
|
-
}
|
|
36
|
-
: constraintIn;
|
|
37
|
-
return semver.satisfies(require(`${packageName}/package.json`).version, constraint.range, typeof constraint.options === 'object'
|
|
38
|
-
? { ...BASE_SATISFIES_OPTIONS, ...constraint.options }
|
|
39
|
-
: constraint.options);
|
|
40
|
-
}
|
|
41
|
-
function satisfiesAllDependencyConstraints(dependencyConstraints) {
|
|
42
|
-
if (dependencyConstraints == null) {
|
|
43
|
-
return true;
|
|
44
|
-
}
|
|
45
|
-
for (const [packageName, constraint] of Object.entries(dependencyConstraints)) {
|
|
46
|
-
if (!satisfiesDependencyConstraint(packageName, constraint)) {
|
|
47
|
-
return false;
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
return true;
|
|
51
|
-
}
|
|
52
|
-
exports.satisfiesAllDependencyConstraints = satisfiesAllDependencyConstraints;
|
|
53
|
-
//# sourceMappingURL=dependencyConstraints.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"dependencyConstraints.js","sourceRoot":"","sources":["../../../src/eslint-utils/rule-tester/dependencyConstraints.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+CAAiC;AAmBjC,MAAM,sBAAsB,GAAwB;IAClD,iBAAiB,EAAE,IAAI;CACxB,CAAC;AAEF,SAAS,6BAA6B,CACpC,WAAmB,EACnB,YAA0C;IAE1C,MAAM,UAAU,GACd,OAAO,YAAY,KAAK,QAAQ;QAC9B,CAAC,CAAC;YACE,KAAK,EAAE,KAAK,YAAY,EAAE;SAC3B;QACH,CAAC,CAAC,YAAY,CAAC;IAEnB,OAAO,MAAM,CAAC,SAAS,CACpB,OAAO,CAAC,GAAG,WAAW,eAAe,CAAyB,CAAC,OAAO,EACvE,UAAU,CAAC,KAAK,EAChB,OAAO,UAAU,CAAC,OAAO,KAAK,QAAQ;QACpC,CAAC,CAAC,EAAE,GAAG,sBAAsB,EAAE,GAAG,UAAU,CAAC,OAAO,EAAE;QACtD,CAAC,CAAC,UAAU,CAAC,OAAO,CACvB,CAAC;AACJ,CAAC;AAED,SAAS,iCAAiC,CACxC,qBAAuD;IAEvD,IAAI,qBAAqB,IAAI,IAAI,EAAE;QACjC,OAAO,IAAI,CAAC;KACb;IAED,KAAK,MAAM,CAAC,WAAW,EAAE,UAAU,CAAC,IAAI,MAAM,CAAC,OAAO,CACpD,qBAAqB,CACtB,EAAE;QACD,IAAI,CAAC,6BAA6B,CAAC,WAAW,EAAE,UAAU,CAAC,EAAE;YAC3D,OAAO,KAAK,CAAC;SACd;KACF;IAED,OAAO,IAAI,CAAC;AACd,CAAC;AAEQ,8EAAiC"}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|