Skip to content

Commit

Permalink
Exclude test files from some linting rules for now
Browse files Browse the repository at this point in the history
  • Loading branch information
matthew-dean committed Apr 2, 2023
1 parent 5e64d5b commit 7181a98
Show file tree
Hide file tree
Showing 10 changed files with 122 additions and 108 deletions.
15 changes: 14 additions & 1 deletion packages/less/.eslintrc.js
Expand Up @@ -45,6 +45,19 @@ module.exports = {
*/
'@typescript-eslint/no-explicit-any': 0
}
}
},
{
files: ['test/**/*.{js,ts}', 'benchmark/index.js'],
/**
* @todo - fix later
*/
rules: {
'no-undef': 0,
'no-useless-escape': 0,
'no-unused-vars': 0,
'no-redeclare': 0,
'@typescript-eslint/no-unused-vars': 0
}
},
]
}
22 changes: 11 additions & 11 deletions packages/less/benchmark/index.js
@@ -1,6 +1,6 @@
var path = require('path'),
fs = require('fs'),
now = require("performance-now");
now = require('performance-now');

var less = require('../.');
var file = path.join(__dirname, 'benchmark.less');
Expand All @@ -10,12 +10,12 @@ if (process.argv[2]) { file = path.join(process.cwd(), process.argv[2]) }
fs.readFile(file, 'utf8', function (e, data) {
var start, total;

console.log("Benchmarking...\n", path.basename(file) + " (" +
parseInt(data.length / 1024) + " KB)", "");
console.log('Benchmarking...\n', path.basename(file) + ' (' +
parseInt(data.length / 1024) + ' KB)', '');

var renderBenchmark = []
, parserBenchmark = []
, evalBenchmark = [];
, parserBenchmark = []
, evalBenchmark = [];

var totalruns = 30;
var ignoreruns = 5;
Expand Down Expand Up @@ -74,13 +74,13 @@ fs.readFile(file, 'utf8', function (e, data) {
var variation = maxtime - mintime;
var variationperc = (variation / avgtime) * 100;

console.log("Min. Time: " + Math.round(mintime) + " ms");
console.log("Max. Time: " + Math.round(maxtime) + " ms");
console.log("Total Average Time: " + Math.round(avgtime) + " ms (" +
console.log('Min. Time: ' + Math.round(mintime) + ' ms');
console.log('Max. Time: ' + Math.round(maxtime) + ' ms');
console.log('Total Average Time: ' + Math.round(avgtime) + ' ms (' +
parseInt(1000 / avgtime *
data.length / 1024) + " KB\/s)");
console.log("+/- " + Math.round(variationperc) + "%");
console.log("");
data.length / 1024) + ' KB\/s)');
console.log('+/- ' + Math.round(variationperc) + '%');
console.log('');
}

analyze('Parsing', parserBenchmark);
Expand Down
2 changes: 1 addition & 1 deletion packages/less/build/rollup.js
Expand Up @@ -47,7 +47,7 @@ async function buildBrowser() {
include: [/^.+\.min\.js$/],
output: {
comments: function(node, comment) {
if (comment.type == "comment2") {
if (comment.type == 'comment2') {
// preserve banner
return /@license/i.test(comment.value);
}
Expand Down
1 change: 1 addition & 0 deletions packages/less/package.json
Expand Up @@ -38,6 +38,7 @@
"test": "grunt test",
"grunt": "grunt",
"lint": "eslint '**/*.{ts,js}'",
"lint:fix": "eslint '**/*.{ts,js}' --fix",
"build": "npm-run-all clean compile",
"clean": "shx rm -rf ./lib tsconfig.tsbuildinfo",
"compile": "tsc -p tsconfig.json",
Expand Down
2 changes: 1 addition & 1 deletion packages/less/src/less/default-options.js
Expand Up @@ -67,4 +67,4 @@ export default function() {
/* This option allows you to specify a argument to go on to every URL. */
urlArgs: ''
}
};
}
38 changes: 19 additions & 19 deletions packages/less/test/browser/generator/benchmark.config.js
Expand Up @@ -3,48 +3,48 @@ module.exports = {
current: {
// src is used to build list of less files to compile
src: [
"benchmark/benchmark.less"
'benchmark/benchmark.less'
],
options: {
helpers: "benchmark/browseroptions.js",
specs: "benchmark/browserspec.js",
outfile: "tmp/browser/test-runner-benchmark-current.html"
helpers: 'benchmark/browseroptions.js',
specs: 'benchmark/browserspec.js',
outfile: 'tmp/browser/test-runner-benchmark-current.html'
}
},
v3_10_3: {
// src is used to build list of less files to compile
src: [
"benchmark/benchmark.less"
'benchmark/benchmark.less'
],
options: {
helpers: "benchmark/browseroptions.js",
specs: "benchmark/browserspec.js",
outfile: "tmp/browser/test-runner-benchmark-v3_10_3.html",
less: "https://cdnjs.cloudflare.com/ajax/libs/less.js/3.10.3/less.min.js"
helpers: 'benchmark/browseroptions.js',
specs: 'benchmark/browserspec.js',
outfile: 'tmp/browser/test-runner-benchmark-v3_10_3.html',
less: 'https://cdnjs.cloudflare.com/ajax/libs/less.js/3.10.3/less.min.js'
}
},
v3_9_0: {
// src is used to build list of less files to compile
src: [
"benchmark/benchmark.less"
'benchmark/benchmark.less'
],
options: {
helpers: "benchmark/browseroptions.js",
specs: "benchmark/browserspec.js",
outfile: "tmp/browser/test-runner-benchmark-v3_9_0.html",
less: "https://cdnjs.cloudflare.com/ajax/libs/less.js/3.9.0/less.min.js"
helpers: 'benchmark/browseroptions.js',
specs: 'benchmark/browserspec.js',
outfile: 'tmp/browser/test-runner-benchmark-v3_9_0.html',
less: 'https://cdnjs.cloudflare.com/ajax/libs/less.js/3.9.0/less.min.js'
}
},
v2_7_3: {
// src is used to build list of less files to compile
src: [
"benchmark/benchmark.less"
'benchmark/benchmark.less'
],
options: {
helpers: "benchmark/browseroptions.js",
specs: "benchmark/browserspec.js",
outfile: "tmp/browser/test-runner-benchmark-v2_7_3.html",
less: "https://cdnjs.cloudflare.com/ajax/libs/less.js/2.7.3/less.min.js"
helpers: 'benchmark/browseroptions.js',
specs: 'benchmark/browserspec.js',
outfile: 'tmp/browser/test-runner-benchmark-v2_7_3.html',
less: 'https://cdnjs.cloudflare.com/ajax/libs/less.js/2.7.3/less.min.js'
}
}
}
138 changes: 69 additions & 69 deletions packages/less/test/browser/generator/runner.config.js
Expand Up @@ -19,168 +19,168 @@ module.exports = {
`!${lessFolder}/_main/empty.less`
],
options: {
helpers: "test/browser/runner-main-options.js",
specs: "test/browser/runner-main-spec.js",
outfile: "tmp/browser/test-runner-main.html"
helpers: 'test/browser/runner-main-options.js',
specs: 'test/browser/runner-main-spec.js',
outfile: 'tmp/browser/test-runner-main.html'
}
},
legacy: {
src: [`${lessFolder}/legacy/*.less`],
options: {
helpers: "test/browser/runner-legacy-options.js",
specs: "test/browser/runner-legacy-spec.js",
outfile: "tmp/browser/test-runner-legacy.html"
helpers: 'test/browser/runner-legacy-options.js',
specs: 'test/browser/runner-legacy-spec.js',
outfile: 'tmp/browser/test-runner-legacy.html'
}
},
strictUnits: {
src: [`${lessFolder}/strict-units/*.less`],
options: {
helpers: "test/browser/runner-strict-units-options.js",
specs: "test/browser/runner-strict-units-spec.js",
outfile: "tmp/browser/test-runner-strict-units.html"
helpers: 'test/browser/runner-strict-units-options.js',
specs: 'test/browser/runner-strict-units-spec.js',
outfile: 'tmp/browser/test-runner-strict-units.html'
}
},
errors: {
src: [
`${lessFolder}/errors/*.less`,
`${testFolder}/errors/javascript-error.less`,
"test/browser/less/errors/*.less"
'test/browser/less/errors/*.less'
],
options: {
timeout: 20000,
helpers: "test/browser/runner-errors-options.js",
specs: "test/browser/runner-errors-spec.js",
outfile: "tmp/browser/test-runner-errors.html"
helpers: 'test/browser/runner-errors-options.js',
specs: 'test/browser/runner-errors-spec.js',
outfile: 'tmp/browser/test-runner-errors.html'
}
},
noJsErrors: {
src: [`${lessFolder}/no-js-errors/*.less`],
options: {
helpers: "test/browser/runner-no-js-errors-options.js",
specs: "test/browser/runner-no-js-errors-spec.js",
outfile: "tmp/browser/test-runner-no-js-errors.html"
helpers: 'test/browser/runner-no-js-errors-options.js',
specs: 'test/browser/runner-no-js-errors-spec.js',
outfile: 'tmp/browser/test-runner-no-js-errors.html'
}
},
browser: {
src: [
"test/browser/less/*.less",
"test/browser/less/plugin/*.less"
'test/browser/less/*.less',
'test/browser/less/plugin/*.less'
],
options: {
helpers: "test/browser/runner-browser-options.js",
specs: "test/browser/runner-browser-spec.js",
outfile: "tmp/browser/test-runner-browser.html"
helpers: 'test/browser/runner-browser-options.js',
specs: 'test/browser/runner-browser-spec.js',
outfile: 'tmp/browser/test-runner-browser.html'
}
},
relativeUrls: {
src: ["test/browser/less/relative-urls/*.less"],
src: ['test/browser/less/relative-urls/*.less'],
options: {
helpers: "test/browser/runner-relative-urls-options.js",
specs: "test/browser/runner-relative-urls-spec.js",
outfile: "tmp/browser/test-runner-relative-urls.html"
helpers: 'test/browser/runner-relative-urls-options.js',
specs: 'test/browser/runner-relative-urls-spec.js',
outfile: 'tmp/browser/test-runner-relative-urls.html'
}
},
rewriteUrls: {
src: ["test/browser/less/rewrite-urls/*.less"],
src: ['test/browser/less/rewrite-urls/*.less'],
options: {
helpers: "test/browser/runner-rewrite-urls-options.js",
specs: "test/browser/runner-rewrite-urls-spec.js",
outfile: "tmp/browser/test-runner-rewrite-urls.html"
helpers: 'test/browser/runner-rewrite-urls-options.js',
specs: 'test/browser/runner-rewrite-urls-spec.js',
outfile: 'tmp/browser/test-runner-rewrite-urls.html'
}
},
rootpath: {
src: ["test/browser/less/rootpath/*.less"],
src: ['test/browser/less/rootpath/*.less'],
options: {
helpers: "test/browser/runner-rootpath-options.js",
specs: "test/browser/runner-rootpath-spec.js",
outfile: "tmp/browser/test-runner-rootpath.html"
helpers: 'test/browser/runner-rootpath-options.js',
specs: 'test/browser/runner-rootpath-spec.js',
outfile: 'tmp/browser/test-runner-rootpath.html'
}
},
rootpathRelative: {
src: ["test/browser/less/rootpath-relative/*.less"],
src: ['test/browser/less/rootpath-relative/*.less'],
options: {
helpers: "test/browser/runner-rootpath-relative-options.js",
specs: "test/browser/runner-rootpath-relative-spec.js",
outfile: "tmp/browser/test-runner-rootpath-relative.html"
helpers: 'test/browser/runner-rootpath-relative-options.js',
specs: 'test/browser/runner-rootpath-relative-spec.js',
outfile: 'tmp/browser/test-runner-rootpath-relative.html'
}
},
rootpathRewriteUrls: {
src: ["test/browser/less/rootpath-rewrite-urls/*.less"],
src: ['test/browser/less/rootpath-rewrite-urls/*.less'],
options: {
helpers:
"test/browser/runner-rootpath-rewrite-urls-options.js",
specs: "test/browser/runner-rootpath-rewrite-urls-spec.js",
'test/browser/runner-rootpath-rewrite-urls-options.js',
specs: 'test/browser/runner-rootpath-rewrite-urls-spec.js',
outfile:
"tmp/browser/test-runner-rootpath-rewrite-urls.html"
'tmp/browser/test-runner-rootpath-rewrite-urls.html'
}
},
production: {
src: ["test/browser/less/production/*.less"],
src: ['test/browser/less/production/*.less'],
options: {
helpers: "test/browser/runner-production-options.js",
specs: "test/browser/runner-production-spec.js",
outfile: "tmp/browser/test-runner-production.html"
helpers: 'test/browser/runner-production-options.js',
specs: 'test/browser/runner-production-spec.js',
outfile: 'tmp/browser/test-runner-production.html'
}
},
modifyVars: {
src: ["test/browser/less/modify-vars/*.less"],
src: ['test/browser/less/modify-vars/*.less'],
options: {
helpers: "test/browser/runner-modify-vars-options.js",
specs: "test/browser/runner-modify-vars-spec.js",
outfile: "tmp/browser/test-runner-modify-vars.html"
helpers: 'test/browser/runner-modify-vars-options.js',
specs: 'test/browser/runner-modify-vars-spec.js',
outfile: 'tmp/browser/test-runner-modify-vars.html'
}
},
globalVars: {
src: ["test/browser/less/global-vars/*.less"],
src: ['test/browser/less/global-vars/*.less'],
options: {
helpers: "test/browser/runner-global-vars-options.js",
specs: "test/browser/runner-global-vars-spec.js",
outfile: "tmp/browser/test-runner-global-vars.html"
helpers: 'test/browser/runner-global-vars-options.js',
specs: 'test/browser/runner-global-vars-spec.js',
outfile: 'tmp/browser/test-runner-global-vars.html'
}
},
postProcessorPlugin: {
src: [`${lessFolder}/postProcessorPlugin/*.less`],
options: {
helpers: [
`test/plugins/postprocess/index.js`,
"test/browser/runner-postProcessorPlugin-options.js"
'test/plugins/postprocess/index.js',
'test/browser/runner-postProcessorPlugin-options.js'
],
specs: "test/browser/runner-postProcessorPlugin.js",
specs: 'test/browser/runner-postProcessorPlugin.js',
outfile:
"tmp/browser/test-runner-post-processor-plugin.html"
'tmp/browser/test-runner-post-processor-plugin.html'
}
},
preProcessorPlugin: {
src: [`${lessFolder}/preProcessorPlugin/*.less`],
options: {
helpers: [
`test/plugins/preprocess/index.js`,
"test/browser/runner-preProcessorPlugin-options.js"
'test/plugins/preprocess/index.js',
'test/browser/runner-preProcessorPlugin-options.js'
],
specs: "test/browser/runner-preProcessorPlugin.js",
outfile: "tmp/browser/test-runner-pre-processor-plugin.html"
specs: 'test/browser/runner-preProcessorPlugin.js',
outfile: 'tmp/browser/test-runner-pre-processor-plugin.html'
}
},
visitorPlugin: {
src: [`${lessFolder}/visitorPlugin/*.less`],
options: {
helpers: [
`test/plugins/visitor/index.js`,
"test/browser/runner-VisitorPlugin-options.js"
'test/plugins/visitor/index.js',
'test/browser/runner-VisitorPlugin-options.js'
],
specs: "test/browser/runner-VisitorPlugin.js",
outfile: "tmp/browser/test-runner-visitor-plugin.html"
specs: 'test/browser/runner-VisitorPlugin.js',
outfile: 'tmp/browser/test-runner-visitor-plugin.html'
}
},
filemanagerPlugin: {
src: [`${lessFolder}/filemanagerPlugin/*.less`],
options: {
helpers: [
`test/plugins/filemanager/index.js`,
"test/browser/runner-filemanagerPlugin-options.js"
'test/plugins/filemanager/index.js',
'test/browser/runner-filemanagerPlugin-options.js'
],
specs: "test/browser/runner-filemanagerPlugin.js",
outfile: "tmp/browser/test-runner-filemanager-plugin.html"
specs: 'test/browser/runner-filemanagerPlugin.js',
outfile: 'tmp/browser/test-runner-filemanager-plugin.html'
}
}
}

0 comments on commit 7181a98

Please sign in to comment.