-
Notifications
You must be signed in to change notification settings - Fork 79
/
depcheck.config.js
68 lines (65 loc) · 2.38 KB
/
depcheck.config.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
/**
* README
* This file contains a subset of critical dependency validation rules for the transformer packages.
* There are certain dependencies we need to be careful of introducing as we refactor the transformers,
* including access to @aws-amplify/* namespaced packages (namely core, printer),
* but we also wish to limit imports to `fs`, and a few other particular places.
*/
// List of v2 transformer directories.
const GQL_V2_TRANSFORMER_PACKAGES = [
'amplify-graphql-auth-transformer',
'amplify-graphql-default-value-transformer',
'amplify-graphql-function-transformer',
'amplify-graphql-http-transformer',
'amplify-graphql-index-transformer',
'amplify-graphql-name-mapping-transformer',
'amplify-graphql-model-transformer',
'amplify-graphql-predictions-transformer',
'amplify-graphql-relational-transformer',
'amplify-graphql-searchable-transformer',
'amplify-graphql-transformer-core',
'amplify-graphql-transformer-interfaces',
'graphql-transformer-common',
'graphql-mapping-template',
'amplify-graphql-transformer',
];
const TRANSFORMER_RESTRICTED_IMPORTS = ['fs', 'fs-extra', '@aws-amplify/amplify-cli-core', '@aws-amplify/amplify-prompts'];
module.exports = {
parser: '@typescript-eslint/parser', // Specifies the ESLint parser
env: {
es6: true,
node: true,
jest: true,
},
parserOptions: {
ecmaVersion: 2020, // Allows for the parsing of modern ECMAScript features
sourceType: 'module', // Allows for the use of imports
ecmaFeatures: {
arrowFunctions: true,
modules: true,
module: true,
},
project: ['tsconfig.eslint.json', 'tsconfig.base.json'],
},
plugins: ['@typescript-eslint', 'spellcheck', 'import', 'jsdoc', 'prefer-arrow'],
settings: {
'import/parsers': { '@typescript-eslint/parser': ['.ts', '.tsx'] },
'import/resolver': { typescript: {} },
},
ignorePatterns: ['__tests__/**', '*.test.ts', 'lib/**', 'node_modules', '*/node_modules'],
overrides: [
{
files: GQL_V2_TRANSFORMER_PACKAGES.map((packageName) => `packages/${packageName}/src/**`),
excludedFiles: ['__tests__/**', '*.test.ts'],
rules: {
'no-restricted-imports': [
'error',
...TRANSFORMER_RESTRICTED_IMPORTS.map((importName) => ({
name: importName,
message: `${importName} is not allowed in transformer v2 packages`,
})),
],
},
},
],
};