@@ -4,42 +4,9 @@ import { promisify } from 'util';
4
4
import { resolve } from 'path' ;
5
5
import tslint from 'danger-plugin-tslint' ;
6
6
import { prettyResults } from 'danger-plugin-tslint/dist/prettyResults' ;
7
- import { CLIEngine } from 'eslint' ;
8
7
9
8
const packages = [ 'apm' , 'core' , 'hub' , 'integrations' , 'minimal' , 'node' , 'types' , 'utils' ] ;
10
9
11
- /**
12
- * Eslint your code with Danger
13
- * Based on fork from: https://github.com/appcelerator/danger-plugin-eslint
14
- */
15
- async function eslint ( ) : Promise < void [ ] > {
16
- const allFiles = danger . git . created_files . concat ( danger . git . modified_files ) ;
17
- const cli = new CLIEngine ( { } ) ;
18
- // let eslint filter down to non-ignored, matching the extensions expected
19
- const filesToLint = allFiles . filter ( f => ! cli . isPathIgnored ( f ) || ! f . endsWith ( 'lock' ) || ! f . endsWith ( 'json' ) ) ;
20
- return Promise . all ( filesToLint . map ( f => lintFile ( cli , f ) ) ) ;
21
- }
22
-
23
- /** JSDoc */
24
- async function lintFile ( linter : CLIEngine , path : string ) : Promise < void > {
25
- const contents = await danger . github . utils . fileContents ( path ) ;
26
- const report = linter . executeOnText ( contents , path ) ;
27
-
28
- if ( report . results . length !== 0 ) {
29
- report . results [ 0 ] . messages . map ( msg => {
30
- if ( msg . fatal ) {
31
- fail ( `Fatal error linting ${ path } with eslint.` ) ;
32
- return ;
33
- }
34
-
35
- const noop = ( ) : void => undefined ;
36
- const fn = { 0 : noop , 1 : warn , 2 : fail } [ msg . severity ] ;
37
-
38
- fn ( `${ path } line ${ msg . line } – ${ msg . message } (${ msg . ruleId } )` , path , msg . line ) ;
39
- } ) ;
40
- }
41
- }
42
-
43
10
export default async ( ) : Promise < void > => {
44
11
if ( ! danger . github ) {
45
12
return ;
@@ -74,8 +41,6 @@ export default async (): Promise<void> => {
74
41
}
75
42
} ) ;
76
43
77
- await eslint ( ) ;
78
-
79
44
const hasChangelog = danger . git . modified_files . indexOf ( 'CHANGELOG.md' ) !== - 1 ;
80
45
const isTrivial = ( danger . github . pr . body + danger . github . pr . title ) . includes ( '#trivial' ) ;
81
46
0 commit comments