Skip to content
This repository was archived by the owner on Jul 24, 2024. It is now read-only.

Commit 6308bd9

Browse files
committed
fix: Bump ESLint to 7.10 and fix new issues
1 parent 1c5b522 commit 6308bd9

File tree

10 files changed

+68
-68
lines changed

10 files changed

+68
-68
lines changed

bin/node-sass

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -300,15 +300,15 @@ function run(options, emitter) {
300300
}
301301

302302
if (options.importer) {
303-
if ((path.resolve(options.importer) === path.normalize(options.importer).replace(/(.+)([\/|\\])$/, '$1'))) {
303+
if ((path.resolve(options.importer) === path.normalize(options.importer).replace(/(.+)([/|\\])$/, '$1'))) {
304304
options.importer = require(options.importer);
305305
} else {
306306
options.importer = require(path.resolve(options.importer));
307307
}
308308
}
309309

310310
if (options.functions) {
311-
if ((path.resolve(options.functions) === path.normalize(options.functions).replace(/(.+)([\/|\\])$/, '$1'))) {
311+
if ((path.resolve(options.functions) === path.normalize(options.functions).replace(/(.+)([/|\\])$/, '$1'))) {
312312
options.functions = require(options.functions);
313313
} else {
314314
options.functions = require(path.resolve(options.functions));

lib/index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ function getLinefeed(options) {
165165
function buildIncludePaths(options) {
166166
options.includePaths = options.includePaths || [];
167167

168-
if (process.env.hasOwnProperty('SASS_PATH')) {
168+
if (Object.prototype.hasOwnProperty.call(process.env, 'SASS_PATH')) {
169169
options.includePaths = options.includePaths.concat(
170170
process.env.SASS_PATH.split(path.delimiter)
171171
);
@@ -193,7 +193,7 @@ function getOptions(opts, cb) {
193193
var options = clonedeep(opts || {});
194194

195195
options.sourceComments = options.sourceComments || false;
196-
if (options.hasOwnProperty('file')) {
196+
if (Object.prototype.hasOwnProperty.call(options, 'file')) {
197197
options.file = getInputFile(options);
198198
}
199199
options.outFile = getOutputFile(options);

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
"coverage": "node scripts/coverage.js",
3131
"install": "node scripts/install.js",
3232
"postinstall": "node scripts/build.js",
33-
"lint": "node_modules/.bin/eslint bin/node-sass lib scripts test",
33+
"lint": "eslint bin/node-sass lib scripts test",
3434
"test": "node_modules/.bin/mocha test/{*,**/**}.js",
3535
"build": "node scripts/build.js --force",
3636
"prepublish": "not-in-install && node scripts/prepublish.js || in-install"
@@ -73,7 +73,7 @@
7373
},
7474
"devDependencies": {
7575
"coveralls": "^3.0.2",
76-
"eslint": "^3.4.0",
76+
"eslint": "^7.10.0",
7777
"fs-extra": "^0.30.0",
7878
"istanbul": "^0.4.2",
7979
"mocha": "^3.1.2",

scripts/build.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,9 @@ function afterBuild(options) {
1919
var install = sass.getBinaryPath();
2020
var target = path.join(__dirname, '..', 'build',
2121
options.debug ? 'Debug' :
22-
process.config.target_defaults
23-
? process.config.target_defaults.default_configuration
24-
: 'Release',
22+
process.config.target_defaults
23+
? process.config.target_defaults.default_configuration
24+
: 'Release',
2525
'binding.node');
2626

2727
mkdir(path.dirname(install), function(err) {

scripts/coverage.js

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ function coverage() {
2929
fs.readFile(path.join('coverage', 'lcov.info'), function(err, data) {
3030
if (err) { console.error(err); }
3131
coveralls.handleInput(data.toString(),
32-
function (err) { if (err) { console.error(err); } });
32+
function (err) { if (err) { console.error(err); } });
3333
});
3434
});
3535
lcov.writeReport(collector, true);
@@ -47,28 +47,28 @@ function coverage() {
4747
mkdirp('lib-cov', function(err) {
4848
if (err) { throw err; }
4949
fs.writeFile(path.join('lib-cov', source),
50-
instrumenter.instrumentSync(data.toString(),
51-
path.join('lib', source)),
52-
function(err) {
53-
if (err) { throw err; }
54-
instrumentedfiles.push(source);
55-
if (instrumentedfiles.length === sourcefiles.length) {
56-
fs.readdirSync('test').filter(function(file){
57-
return file.substr(-6) === 'api.js' ||
50+
instrumenter.instrumentSync(data.toString(),
51+
path.join('lib', source)),
52+
function(err) {
53+
if (err) { throw err; }
54+
instrumentedfiles.push(source);
55+
if (instrumentedfiles.length === sourcefiles.length) {
56+
fs.readdirSync('test').filter(function(file){
57+
return file.substr(-6) === 'api.js' ||
5858
file.substr(-11) === 'runtime.js';
59-
}).forEach(function(file){
60-
mocha.addFile(
61-
path.join('test', file)
62-
);
63-
});
64-
process.env.NODESASS_COV = 1;
65-
mocha.reporter(rep).run(function(failures) {
66-
process.on('exit', function () {
67-
process.exit(failures);
68-
});
69-
});
70-
}
71-
});
59+
}).forEach(function(file){
60+
mocha.addFile(
61+
path.join('test', file)
62+
);
63+
});
64+
process.env.NODESASS_COV = 1;
65+
mocha.reporter(rep).run(function(failures) {
66+
process.on('exit', function () {
67+
process.exit(failures);
68+
});
69+
});
70+
}
71+
});
7272
});
7373
});
7474
};

scripts/install.js

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -68,22 +68,22 @@ function download(url, dest, cb) {
6868
}
6969
}
7070
})
71-
.on('response', function(response) {
72-
var length = parseInt(response.headers['content-length'], 10);
73-
var progress = log.newItem('', length);
74-
75-
// The `progress` is true by default. However if it has not
76-
// been explicitly set it's `undefined` which is considered
77-
// as far as npm is concerned.
78-
if (process.env.npm_config_progress === 'true') {
79-
log.enableProgress();
80-
81-
response.on('data', function(chunk) {
82-
progress.completeWork(chunk.length);
83-
})
84-
.on('end', progress.finish);
85-
}
86-
});
71+
.on('response', function(response) {
72+
var length = parseInt(response.headers['content-length'], 10);
73+
var progress = log.newItem('', length);
74+
75+
// The `progress` is true by default. However if it has not
76+
// been explicitly set it's `undefined` which is considered
77+
// as far as npm is concerned.
78+
if (process.env.npm_config_progress === 'true') {
79+
log.enableProgress();
80+
81+
response.on('data', function(chunk) {
82+
progress.completeWork(chunk.length);
83+
})
84+
.on('end', progress.finish);
85+
}
86+
});
8787
} catch (err) {
8888
cb(err);
8989
}

test/api.js

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ var assert = require('assert').strict,
55
path = require('path'),
66
read = fs.readFileSync,
77
sassPath = process.env.NODESASS_COV
8-
? require.resolve('../lib-cov')
9-
: require.resolve('../lib'),
8+
? require.resolve('../lib-cov')
9+
: require.resolve('../lib'),
1010
sass = require(sassPath),
1111
fixture = path.join.bind(null, __dirname, 'fixtures'),
1212
resolveFixture = path.resolve.bind(null, __dirname, 'fixtures');
@@ -68,7 +68,7 @@ describe('api', function() {
6868
file: fixture('simple/index.scss'),
6969
sourceMap: false
7070
}, function(error, result) {
71-
assert.strictEqual(result.hasOwnProperty('map'), false, 'result has a map property');
71+
assert.strictEqual(Object.prototype.hasOwnProperty.call(result, 'map'), false, 'result has a map property');
7272
done();
7373
});
7474
});
@@ -78,7 +78,7 @@ describe('api', function() {
7878
file: fixture('simple/index.scss'),
7979
sourceMap: true
8080
}, function(error, result) {
81-
assert.strictEqual(result.hasOwnProperty('map'), false, 'result has a map property');
81+
assert.strictEqual(Object.prototype.hasOwnProperty.call(result, 'map'), false, 'result has a map property');
8282
done();
8383
});
8484
});
@@ -654,7 +654,7 @@ describe('api', function() {
654654
done(new Error('doesn\'t exist!'));
655655
}
656656
}, function(error) {
657-
assert(/doesn\'t exist!/.test(error.message));
657+
assert(/doesn't exist!/.test(error.message));
658658
done();
659659
});
660660
});
@@ -666,7 +666,7 @@ describe('api', function() {
666666
return new Error('doesn\'t exist!');
667667
}
668668
}, function(error) {
669-
assert(/doesn\'t exist!/.test(error.message));
669+
assert(/doesn't exist!/.test(error.message));
670670
done();
671671
});
672672
});
@@ -1196,7 +1196,7 @@ describe('api', function() {
11961196
},
11971197
bar: function(a) {
11981198
assert.strictEqual(a, sass.NULL,
1199-
'Supplied value should be the same instance as sass.NULL');
1199+
'Supplied value should be the same instance as sass.NULL');
12001200

12011201
assert.throws(function() {
12021202
return new sass.types.Null();
@@ -1374,7 +1374,7 @@ describe('api', function() {
13741374
sourceMap: false
13751375
});
13761376

1377-
assert.strictEqual(result.hasOwnProperty('map'), false, 'result has a map property');
1377+
assert.strictEqual(Object.prototype.hasOwnProperty.call(result, 'map'), false, 'result has a map property');
13781378
done();
13791379
});
13801380

@@ -1384,7 +1384,7 @@ describe('api', function() {
13841384
sourceMap: true
13851385
});
13861386

1387-
assert.strictEqual(result.hasOwnProperty('map'), false, 'result has a map property');
1387+
assert.strictEqual(Object.prototype.hasOwnProperty.call(result, 'map'), false, 'result has a map property');
13881388
done();
13891389
});
13901390

@@ -1765,7 +1765,7 @@ describe('api', function() {
17651765
return new Error('doesn\'t exist!');
17661766
}
17671767
});
1768-
}, /doesn\'t exist!/);
1768+
}, /doesn't exist!/);
17691769

17701770
done();
17711771
});

test/binding.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ var assert = require('assert').strict,
44
path = require('path'),
55
etx = require('../lib/extensions'),
66
binding = process.env.NODESASS_COV
7-
? require('../lib-cov/binding')
8-
: require('../lib/binding');
7+
? require('../lib-cov/binding')
8+
: require('../lib/binding');
99

1010
describe('binding', function() {
1111
describe('missing error', function() {

test/lowlevel.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ describe('lowlevel', function() {
3030

3131
binding.renderSync(options);
3232
assert(/Data context created without a source string/.test(options.result.error),
33-
'Should fail with error message "Data context created without a source string"');
33+
'Should fail with error message "Data context created without a source string"');
3434
done();
3535
});
3636

@@ -51,7 +51,7 @@ describe('lowlevel', function() {
5151

5252
binding.renderSync(options);
5353
assert(/Data context created without a source string/.test(options.result.error),
54-
'Should fail with error message "Data context created without a source string"');
54+
'Should fail with error message "Data context created without a source string"');
5555
done();
5656
});
5757

@@ -72,7 +72,7 @@ describe('lowlevel', function() {
7272

7373
binding.renderFileSync(options);
7474
assert(/File context created without an input path/.test(options.result.error),
75-
'Should fail with error message "File context created without an input path"');
75+
'Should fail with error message "File context created without an input path"');
7676
done();
7777
});
7878

@@ -93,7 +93,7 @@ describe('lowlevel', function() {
9393

9494
binding.renderFileSync(options);
9595
assert(/File context created without an input path/.test(options.result.error),
96-
'Should fail with error message "File context created without an input path"');
96+
'Should fail with error message "File context created without an input path"');
9797
done();
9898
});
9999

@@ -215,7 +215,7 @@ describe('lowlevel', function() {
215215

216216
binding.renderSync(options);
217217
assert(/empty source string/.test(options.result.error),
218-
'Should fail with error message "Data context created with empty source string"');
218+
'Should fail with error message "Data context created with empty source string"');
219219
done();
220220
});
221221

@@ -236,7 +236,7 @@ describe('lowlevel', function() {
236236

237237
binding.renderFileSync(options);
238238
assert(/empty input path/.test(options.result.error),
239-
'Should fail with error message "File context created with empty input path"');
239+
'Should fail with error message "File context created with empty input path"');
240240
done();
241241
});
242242

test/runtime.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
var assert = require('assert').strict,
22
sass = process.env.NODESASS_COV
3-
? require('../lib-cov/extensions')
4-
: require('../lib/extensions');
3+
? require('../lib-cov/extensions')
4+
: require('../lib/extensions');
55

66
describe('runtime parameters', function() {
77
var pkg = require('../package'),
8-
// Let's use JSON to fake a deep copy
8+
// Let's use JSON to fake a deep copy
99
savedArgv = JSON.stringify(process.argv),
1010
savedEnv = JSON.stringify(process.env);
1111

0 commit comments

Comments
 (0)