This repository was archived by the owner on Aug 7, 2023. It is now read-only.
Commit fb51a78 1 parent a8d5b1c commit fb51a78 Copy full SHA for fb51a78
File tree 2 files changed +10
-20
lines changed
2 files changed +10
-20
lines changed Original file line number Diff line number Diff line change 2
2
3
3
import { CompositeDisposable } from 'atom' ;
4
4
import path from 'path' ;
5
- import fs from 'fs' ;
5
+ import { promises } from 'fs' ;
6
+ const { stat } = promises ;
6
7
import WorkerHelper from './workerHelper' ;
7
8
8
9
const grammarScopes = [ 'source.ts' , 'source.tsx' ] ;
@@ -40,14 +41,13 @@ const TsLintPackage = {
40
41
41
42
// Config subscriptions
42
43
this . subscriptions . add (
43
- atom . config . observe ( 'linter-tslint.rulesDirectory' , ( dir ) => {
44
+ atom . config . observe ( 'linter-tslint.rulesDirectory' , async ( dir ) => {
44
45
if ( dir && path . isAbsolute ( dir ) ) {
45
- fs . stat ( dir , ( err , stats ) => {
46
- if ( stats && stats . isDirectory ( ) ) {
47
- config . rulesDirectory = dir ;
48
- this . workerHelper . changeConfig ( 'rulesDirectory' , dir ) ;
49
- }
50
- } ) ;
46
+ const stats = await stat ( dir ) ;
47
+ if ( stats && stats . isDirectory ( ) ) {
48
+ config . rulesDirectory = dir ;
49
+ this . workerHelper . changeConfig ( 'rulesDirectory' , dir ) ;
50
+ }
51
51
}
52
52
} ) ,
53
53
atom . config . observe ( 'linter-tslint.useLocalTslint' , ( use ) => {
Original file line number Diff line number Diff line change 2
2
3
3
/* global emit */
4
4
5
- import fs from 'fs' ;
5
+ import { promises } from 'fs' ;
6
+ const { stat } = promises ;
6
7
import path from 'path' ;
7
8
import { getRuleUri } from 'tslint-rule-documentation' ;
8
9
import ChildProcess from 'child_process' ;
@@ -19,17 +20,6 @@ const config = {
19
20
let fallbackLinter ;
20
21
let requireResolve ;
21
22
22
- function stat ( pathname ) {
23
- return new Promise ( ( resolve , reject ) => {
24
- fs . stat ( pathname , ( err , stats ) => {
25
- if ( err ) {
26
- return reject ( err ) ;
27
- }
28
- return resolve ( stats ) ;
29
- } ) ;
30
- } ) ;
31
- }
32
-
33
23
/**
34
24
* Shim for TSLint v3 interoperability
35
25
* @param {Function } Linter TSLint v3 linter
You can’t perform that action at this time.
0 commit comments