Skip to content

Commit efdf19b

Browse files
committed
feat: add collection logic
0 parents  commit efdf19b

21 files changed

+8797
-0
lines changed

Diff for: .dependency-cruiser.js

+174
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,174 @@
1+
module.exports = {
2+
extends: "dependency-cruiser/configs/recommended-strict",
3+
/*
4+
the 'dependency-cruiser/configs/recommended-strict' preset
5+
contains these rules:
6+
no-circular - flags all circular dependencies
7+
no-orphans - flags orphan modules (except typescript .d.ts files)
8+
no-deprecated-core - flags dependencies on deprecated node 'core' modules
9+
no-deprecated-npm - flags dependencies on deprecated npm modules
10+
no-non-package-json - flags (npm) dependencies that don't occur in package.json
11+
not-to-unresolvable - flags dependencies that can't be resolved
12+
no-duplicate-dep-types - flags dependencies that occur more than once in package.json
13+
14+
If you need to, you can override these rules. E.g. to ignore the
15+
no-duplicate-dep-types rule, you can set its severity to "ignore" by
16+
adding this to the 'forbidden' section:
17+
{
18+
name: 'no-duplicate-dep-types',
19+
severity: 'ignore'
20+
}
21+
22+
Also, by default, the preset does not follow any external modules (things in
23+
node_modules or in yarn's plug'n'play magic). If you want to have that
24+
differently, just override it the options.doNotFollow key.
25+
*/
26+
forbidden: [
27+
{
28+
name: "not-to-test",
29+
comment:
30+
"This module depends on code within a folder that should only contain tests. As tests don't " +
31+
"implement functionality this is odd. Either you're writing a test outside the test folder " +
32+
"or there's something in the test folder that isn't a test.",
33+
severity: "error",
34+
from: {
35+
pathNot: "^(test|spec)",
36+
},
37+
to: {
38+
path: "^(test|spec)",
39+
},
40+
},
41+
{
42+
name: "not-to-spec",
43+
comment:
44+
"This module depends on a spec (test) file. The sole responsibility of a spec file is to test code. " +
45+
"If there's something in a spec that's of use to other modules, it doesn't have that single " +
46+
"responsibility anymore. Factor it out into (e.g.) a separate utility/ helper or a mock.",
47+
severity: "error",
48+
from: {},
49+
to: {
50+
path: "\\.spec\\.(js|ts|ls|coffee|litcoffee|coffee\\.md)$",
51+
},
52+
},
53+
{
54+
name: "not-to-dev-dep",
55+
severity: "error",
56+
comment:
57+
"This module depends on an npm package from the 'devDependencies' section of your " +
58+
"package.json. It looks like something that ships to production, though. To prevent problems " +
59+
"with npm packages that aren't there on production declare it (only!) in the 'dependencies'" +
60+
"section of your package.json. If this module is development only - add it to the " +
61+
"from.pathNot re of the not-to-dev-dep rule in the dependency-cruiser configuration",
62+
from: {
63+
path: "^(src|app|lib)",
64+
pathNot: "\\.spec\\.(js|ts|ls|coffee|litcoffee|coffee\\.md)$",
65+
},
66+
to: {
67+
dependencyTypes: ["npm-dev"],
68+
},
69+
},
70+
{
71+
name: "optional-deps-used",
72+
severity: "info",
73+
comment:
74+
"This module depends on an npm package that is declared as an optional dependency " +
75+
"in your package.json. As this makes sense in limited situations only, it's flagged here. " +
76+
"If you're using an optional dependency here by design - add an exception to your" +
77+
"depdency-cruiser configuration.",
78+
from: {},
79+
to: {
80+
dependencyTypes: ["npm-optional"],
81+
},
82+
},
83+
{
84+
name: "peer-deps-used",
85+
comment:
86+
"This module depends on an npm package that is declared as a peer dependency " +
87+
"in your package.json. This makes sense if your package is e.g. a plugin, but in " +
88+
"other cases - maybe not so much. If the use of a peer dependency is intentional " +
89+
"add an exception to your dependency-cruiser configuration.",
90+
severity: "warn",
91+
from: {},
92+
to: {
93+
dependencyTypes: ["npm-peer"],
94+
},
95+
},
96+
],
97+
options: {
98+
/* conditions specifying which files not to follow further when encountered:
99+
- path: a regular expression to match
100+
- dependencyTypes: see https://github.com/sverweij/dependency-cruiser/blob/develop/doc/rules-reference.md#dependencytypes
101+
for a complete list
102+
*/
103+
doNotFollow: {
104+
// path: 'node_modules',
105+
dependencyTypes: ["npm", "npm-dev", "npm-optional", "npm-peer", "npm-bundled", "npm-no-pkg"],
106+
},
107+
108+
/* conditions specifying which dependencies to exclude
109+
- path: a regular expression to match
110+
- dynamic: a boolean indicating whether to ignore dynamic (true) or static (false) dependencies.
111+
leave out if you want to exclude neither (recommended!)
112+
*/
113+
// , exclude : {
114+
// path: ''
115+
// , dynamic: true
116+
// }
117+
118+
/* pattern specifying which files to include (regular expression)
119+
dependency-cruiser will skip everything not matching this pattern
120+
*/
121+
// , includeOnly : ''
122+
123+
/* list of module systems to cruise */
124+
// , moduleSystems: ['amd', 'cjs', 'es6', 'tsd']
125+
126+
/* prefix for links in html and svg output (e.g. https://github.com/you/yourrepo/blob/develop/) */
127+
// , prefix: ''
128+
129+
/* if true detect dependencies that only exist before typescript-to-javascript compilation */
130+
tsPreCompilationDeps: true,
131+
132+
/* if true combines the package.jsons found from the module up to the base
133+
folder the cruise is initiated from. Useful for how (some) mono-repos
134+
manage dependencies & dependency definitions.
135+
*/
136+
// , combinedDependencies: false
137+
138+
/* if true leave symlinks untouched, otherwise use the realpath */
139+
// , preserveSymlinks: false
140+
141+
/* Typescript project file ('tsconfig.json') to use for
142+
(1) compilation and
143+
(2) resolution (e.g. with the paths property)
144+
145+
The (optional) fileName attribute specifies which file to take (relative to
146+
dependency-cruiser's current working directory). When not provided
147+
defaults to './tsconfig.json'.
148+
*/
149+
tsConfig: {
150+
fileName: "./tsconfig.json",
151+
},
152+
153+
/* Webpack configuration to use to get resolve options from.
154+
155+
The (optional) fileName attribute specifies which file to take (relative to dependency-cruiser's
156+
current working directory. When not provided defaults to './webpack.conf.js'.
157+
158+
The (optional) `env` and `args` attributes contain the parameters to be passed if
159+
your webpack config is a function and takes them (see webpack documentation
160+
for details)
161+
*/
162+
// , webpackConfig: {
163+
// fileName: './webpack.conf.js'
164+
// , env: {}
165+
// , args: {}
166+
// }
167+
168+
/* How to resolve external modules - use "yarn-pnp" if you're using yarn's Plug'n'Play.
169+
otherwise leave it out (or set to the default, which is 'node_modules')
170+
*/
171+
// , externalModuleResolutionStrategy: 'node_modules'
172+
},
173+
};
174+
// generated: [email protected] on 2019-11-21T01:41:12.817Z

Diff for: .eslintignore

+98
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
2+
# Created by https://www.gitignore.io/api/node
3+
# Edit at https://www.gitignore.io/?templates=node
4+
5+
### Node ###
6+
# Logs
7+
logs
8+
*.log
9+
npm-debug.log*
10+
yarn-debug.log*
11+
yarn-error.log*
12+
lerna-debug.log*
13+
14+
# Diagnostic reports (https://nodejs.org/api/report.html)
15+
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
16+
17+
# Runtime data
18+
pids
19+
*.pid
20+
*.seed
21+
*.pid.lock
22+
23+
# Directory for instrumented libs generated by jscoverage/JSCover
24+
lib-cov
25+
26+
# Coverage directory used by tools like istanbul
27+
coverage
28+
*.lcov
29+
30+
# nyc test coverage
31+
.nyc_output
32+
33+
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
34+
.grunt
35+
36+
# Bower dependency directory (https://bower.io/)
37+
bower_components
38+
39+
# node-waf configuration
40+
.lock-wscript
41+
42+
# Compiled binary addons (https://nodejs.org/api/addons.html)
43+
build/Release
44+
45+
# Dependency directories
46+
node_modules/
47+
jspm_packages/
48+
49+
# TypeScript v1 declaration files
50+
typings/
51+
52+
# TypeScript cache
53+
*.tsbuildinfo
54+
55+
# Optional npm cache directory
56+
.npm
57+
58+
# Optional eslint cache
59+
.eslintcache
60+
61+
# Optional REPL history
62+
.node_repl_history
63+
64+
# Output of 'npm pack'
65+
*.tgz
66+
67+
# Yarn Integrity file
68+
.yarn-integrity
69+
70+
# dotenv environment variables file
71+
.env
72+
.env.test
73+
74+
# parcel-bundler cache (https://parceljs.org/)
75+
.cache
76+
77+
# next.js build output
78+
.next
79+
80+
# nuxt.js build output
81+
.nuxt
82+
83+
# react / gatsby
84+
dist/
85+
86+
# vuepress build output
87+
.vuepress/dist
88+
89+
# Serverless directories
90+
.serverless/
91+
92+
# FuseBox cache
93+
.fusebox/
94+
95+
# DynamoDB Local files
96+
.dynamodb/
97+
98+
# End of https://www.gitignore.io/api/node

Diff for: .eslintrc.js

+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
module.exports = {
2+
parser: "@typescript-eslint/parser",
3+
parserOptions: {
4+
project: "tsconfig.json",
5+
sourceType: "module",
6+
},
7+
extends: ["plugin:@typescript-eslint/recommended", "plugin:import/typescript"],
8+
rules: {
9+
"@typescript-eslint/no-floating-promises": 2,
10+
"@typescript-eslint/triple-slash-reference": [2, { path: "never", types: "never", lib: "never" }],
11+
"@typescript-eslint/no-unnecessary-qualifier": 2,
12+
"@typescript-eslint/unified-signatures": 2,
13+
"no-undef": 0,
14+
"no-redeclare": 0,
15+
"import/export": 0,
16+
"import/named": 0,
17+
"import/no-unresolved": 0,
18+
"import/namespace": 0,
19+
"@typescript-eslint/no-unused-vars": 0,
20+
"@typescript-eslint/no-var-requires": 0,
21+
"@typescript-eslint/explicit-member-accessibility": 0,
22+
"@typescript-eslint/no-namespace": 0,
23+
"@typescript-eslint/explicit-function-return-type": 0,
24+
"@typescript-eslint/no-explicit-any": 0,
25+
"@typescript-eslint/no-empty-interface": 0,
26+
27+
"@typescript-eslint/camelcase": 0,
28+
"react/prop-types": 0,
29+
"@typescript-eslint/no-unnecessary-qualifier": 0,
30+
},
31+
};

0 commit comments

Comments
 (0)