Skip to content

Linter: use async I/O for greater speed #16572

@bershanskiy

Description

@bershanskiy

#16437 introduced a new linter which unfortunately uses only synchronous I/O: existsSync, existsSync (multiple times on the same file!), readFileSync, readdirSync.

if (!fs.existsSync(file)) {

if (fs.statSync(file).isFile() && path.extname(file) === '.json') {

const rawFileData = fs.readFileSync(file, 'utf-8').trim();

if (fs.statSync(file).isDirectory()) {

.readdirSync(file)

This makes linter very slow, on a decent laptop with an SSD time npm run lint produces:

real    0m8.531s
user    0m0.046s
sys     0m0.106s

I like async I/O a lot and if you would be interested in reviewing a PR for async I/O, I can create one.

Metadata

Metadata

Assignees

No one assigned

    Labels

    linterIssues or pull requests regarding the tests / linter of the JSON files.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions