const cwd = require('path').resolve();
const fs = require('fs');
const { COPYFILE_EXCL } = fs.constants;

fs.copyFile('.eslintrc', '../../.eslintrc', COPYFILE_EXCL, (err) => {
    if (err) console.log('Preserving .eslintrc file found at ' + cwd);
});
const fs = require('fs');
const path = require('path');

const cwd = process.cwd();

const eslintrcPath = path.join(cwd, '.eslintrc');

if (!fs.existsSync(eslintrcPath)) {
    fs.writeFileSync(
        eslintrcPath,
        fs.readFileSync(path.join(__dirname, '../.eslintrc'), {
            encoding: 'utf8'
        })
    );

    console.log('Created .eslintrc file at ' + eslintrcPath);
} else {
    console.log('Preserving .eslintrc file found at ' + eslintrcPath);
}

Make post install script compatible with older versions of Node
Make post install script compatible with older versions of Node
