Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ESLint: Add Node plugin with recommended preset for /build folder #12994

Merged
merged 9 commits into from
May 13, 2020
Merged
Show file tree
Hide file tree
Changes from 8 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 14 additions & 1 deletion build/.eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,21 @@
"env": {
"node": true
},
"plugins": [
"node"
],
"extends": [
"plugin:node/recommended"
],
"rules": {
"no-console": "off"
"no-console": "off",
"node/no-unpublished-require": "off",
"node/no-unsupported-features/node-builtins": ["error", { "version": ">=8.5.0" }],
"node/shebang": ["error", {
"convertPath": {
"build/npm-bin/**/*.js": ["^build/npm-bin/(.+?)\\.js$", "bin/$1.js"]
}
}]
},
"globals": {
"console": true
Expand Down
2 changes: 2 additions & 0 deletions build/gulp/aspnet.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
'use strict';

const gulp = require('gulp');
const merge = require('merge-stream');
const rename = require('gulp-rename');
Expand Down
2 changes: 2 additions & 0 deletions build/gulp/bundler-config.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
'use strict';

const gulp = require('gulp');
const replace = require('gulp-replace');
const concat = require('gulp-concat');
Expand Down
2 changes: 2 additions & 0 deletions build/gulp/compression-pipes.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
'use strict';

const lazyPipe = require('lazypipe');
const replace = require('gulp-replace');
const uglify = require('gulp-uglify');
Expand Down
2 changes: 2 additions & 0 deletions build/gulp/context.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
'use strict';

// See tests in version-spec.js

const argv = require('yargs')
Expand Down
2 changes: 2 additions & 0 deletions build/gulp/css-bundles.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
'use strict';

const fs = require('fs');
const path = require('path');
const gulp = require('gulp');
Expand Down
2 changes: 2 additions & 0 deletions build/gulp/gulp-data-uri.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
'use strict';

const replace = require('gulp-replace');
const path = require('path');
const fs = require('fs');
Expand Down
2 changes: 2 additions & 0 deletions build/gulp/header-pipes.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
'use strict';

const fs = require('fs');
const lazyPipe = require('lazypipe');
const header = require('gulp-header');
Expand Down
2 changes: 2 additions & 0 deletions build/gulp/js-bundles.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
'use strict';

const path = require('path');
const gulp = require('gulp');
const gulpIf = require('gulp-if');
Expand Down
2 changes: 2 additions & 0 deletions build/gulp/localization.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
'use strict';

const gulp = require('gulp');
const path = require('path');
const rename = require('gulp-rename');
Expand Down
4 changes: 3 additions & 1 deletion build/gulp/npm.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
'use strict';

const gulp = require('gulp');
const eol = require('gulp-eol');
const replace = require('gulp-replace');
Expand Down Expand Up @@ -56,7 +58,7 @@ const addDefaultExport = lazyPipe().pipe(function() {
const moduleMeta = MODULES.filter(m => m.name === moduleName)[0];

if(moduleMeta && moduleMeta.exports && moduleMeta.exports.default) {
chunk.contents = new Buffer(String(chunk.contents) + 'module.exports.default = module.exports;');
chunk.contents = Buffer.from(String(chunk.contents) + 'module.exports.default = module.exports;');
}
callback(null, chunk);
});
Expand Down
2 changes: 2 additions & 0 deletions build/gulp/scss/common-replacements.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
'use strict';

module.exports = {
// regex, replacement - replace
// import, type - additional import (
Expand Down
2 changes: 2 additions & 0 deletions build/gulp/scss/compiler.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
'use strict';

const sass = require('gulp-dart-sass');
const gulp = require('gulp');
const del = require('del');
Expand Down
2 changes: 2 additions & 0 deletions build/gulp/scss/config.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
'use strict';

module.exports = {
outputPath: 'scss',
unfixedScssPath: 'styles'
Expand Down
10 changes: 6 additions & 4 deletions build/gulp/scss/generator.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
'use strict';

const gulp = require('gulp');
const path = require('path');
const fs = require('fs');
Expand Down Expand Up @@ -98,7 +100,7 @@ gulp.task('fix-bundles', gulp.parallel(
];
let content = chunk.contents.toString();
widgets.forEach(widget => content += `@use "../widgets/common/${widget}";\n`);
chunk.contents = new Buffer(content);
chunk.contents = new Buffer.from(content);
callback(null, chunk);
}))
.pipe(gulp.dest(`${outputPath}/bundles`))
Expand Down Expand Up @@ -153,7 +155,7 @@ gulp.task('fix-base', () => {
let content = file.contents.toString();
content = replaceColorFunctions(content);
content = replaceInterpolatedCalcContent(content);
file.contents = new Buffer(content);
file.contents = Buffer.from(content);
callback(null, file);
}))
.pipe(rename((path) => {
Expand All @@ -176,7 +178,7 @@ gulp.task(function fixCommon() {
content = `@use "../base/mixins" as *;\n// adduse\n${content}`;
content = commonSpecificReplacement(content, chunk.path);
content = replaceInterpolatedCalcContent(content);
chunk.contents = new Buffer(content);
chunk.contents = Buffer.from(content);
callback(null, chunk);
}))
.pipe(gulp.dest(`${outputPath}/widgets/common`));
Expand Down Expand Up @@ -296,7 +298,7 @@ gulp.task('create-widgets', () => {
indexContent = replaceColorFunctions(indexContent);
indexContent = replaceInterpolatedCalcContent(indexContent);
indexContent = indexContent.replace(parentSelectorRegex, parentSelectorReplacement);
chunk.contents = new Buffer(indexContent);
chunk.contents = Buffer.from(indexContent);

let colorsContent = '@use "sass:color";\n';
colorsContent += '@use "../sizes" as *;\n';
Expand Down
2 changes: 2 additions & 0 deletions build/gulp/scss/index-data.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
'use strict';

module.exports = [
// each object has one of these tasks:
// widget - widget reference
Expand Down
2 changes: 2 additions & 0 deletions build/gulp/scss/tasks.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
'use strict';

require('./compiler');
require('./generator');

Expand Down
4 changes: 3 additions & 1 deletion build/gulp/scss/tests/identical.test.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
'use strict';

const fs = require('fs');
const path = require('path');
const cssom = require('cssom');
Expand Down Expand Up @@ -179,4 +181,4 @@ files.forEach(file => {
}
});

process.exit(exitCode);
process.exit(exitCode); // eslint-disable-line no-process-exit
2 changes: 2 additions & 0 deletions build/gulp/scss/theme-replacements.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
'use strict';

module.exports = {
// regex, replacement - replace
// import, type - additional import (
Expand Down
2 changes: 2 additions & 0 deletions build/gulp/style-compiler.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
'use strict';

const gulp = require('gulp');
const path = require('path');
const replace = require('gulp-replace');
Expand Down
2 changes: 2 additions & 0 deletions build/gulp/themebuilder-npm.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
'use strict';

const gulp = require('gulp');
const babel = require('gulp-babel');
const jsonEditor = require('gulp-json-editor');
Expand Down
2 changes: 2 additions & 0 deletions build/gulp/transpile.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
'use strict';

const gulp = require('gulp');
const babel = require('gulp-babel');
const watch = require('gulp-watch');
Expand Down
2 changes: 2 additions & 0 deletions build/gulp/ts.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
'use strict';

const gulp = require('gulp');
const file = require('gulp-file');
const footer = require('gulp-footer');
Expand Down
2 changes: 2 additions & 0 deletions build/gulp/vectormap.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
'use strict';

const gulp = require('gulp');
const path = require('path');
const fs = require('fs');
Expand Down
2 changes: 2 additions & 0 deletions build/gulp/vendor.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
'use strict';

const gulp = require('gulp');
const rename = require('gulp-rename');
const merge = require('merge-stream');
Expand Down
2 changes: 2 additions & 0 deletions build/gulp/version-spec.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
// Tests for the version.js module
// Note: label and revision can't be set at the same time

'use strict';

const versionFunc = require('./version');

const cases = [
Expand Down
2 changes: 2 additions & 0 deletions build/gulp/version.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
'use strict';

const envTail = 'DEVEXTREME_TMP_TAIL';

if(!process.env[envTail]) {
Expand Down
1 change: 1 addition & 0 deletions build/npm-bin/bundler-init.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#!/usr/bin/env node
'use strict';

const fs = require('fs');
const path = require('path');
Expand Down
3 changes: 2 additions & 1 deletion build/npm-bin/bundler.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#!/usr/bin/env node
'use strict';

const path = require('path');
const webpack = require('webpack');
Expand All @@ -10,7 +11,7 @@ let bundle = process.argv.length > 2 ? process.argv[2] : 'dx.custom';

bundle = bundle.replace(/.config.js$/, '');

const baseConfig = require('./webpack.config.js');
const baseConfig = require('./webpack.config.js'); // eslint-disable-line node/no-missing-require
const createConfig = function(outputFile, mode) {
const config = Object.assign({}, baseConfig);

Expand Down
2 changes: 2 additions & 0 deletions build/vectormap-sources/_settings.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
'use strict';

module.exports = {
isQuiet: true
};
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@
"devextreme-cldr-data": "^1.0.2",
"devextreme-internal-tools": "~1.2.0",
"eslint": "^7.0.0",
"eslint-plugin-node": "^11.1.0",
"eslint-plugin-qunit": "^4.0.0",
"eslint-plugin-spellcheck": "0.0.11",
"exceljs": "3.3.1",
Expand Down