-
-
Notifications
You must be signed in to change notification settings - Fork 45
/
Copy pathJsGitignoreCorrectlySetPractice.ts
37 lines (35 loc) · 1.28 KB
/
JsGitignoreCorrectlySetPractice.ts
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
import { PracticeImpact, ProgrammingLanguage } from '../../model';
import { DxPractice } from '../DxPracticeDecorator';
import { ReportDetailType } from '../../reporters/ReporterData';
import { GitignoreCorrectlySetPracticeBase } from '../common/GitignoreCorrectlySetPracticeBase';
@DxPractice({
id: 'JavaScript.GitignoreCorrectlySet',
name: 'Set .gitignore Correctly',
impact: PracticeImpact.high,
suggestion: 'Set patterns in the .gitignore as usual.',
reportOnlyOnce: true,
url: 'https://github.com/github/gitignore/blob/master/Node.gitignore',
dependsOn: { practicing: ['LanguageIndependent.GitignoreIsPresent'] },
})
export class JsGitignoreCorrectlySetPractice extends GitignoreCorrectlySetPracticeBase {
constructor() {
super();
this.applicableLanguages = [ProgrammingLanguage.JavaScript];
this.ruleChecks = [
// node_modules
{ regex: /node_modules/, fix: '/node_modules' },
// misc
{ regex: /coverage/, fix: '/coverage' },
{ regex: /\.log/, fix: '*.log' },
];
}
protected setData() {
this.data.details = [
{
type: ReportDetailType.text,
text:
'You should ignore one of the lock files (package-lock.json or yarn.lock), node_modules folder, coverage folder and log files (*.log)',
},
];
}
}