mirror of
https://github.com/pgadmin-org/pgadmin4.git
synced 2025-02-09 23:15:58 -06:00
Using the '.eslintignore' config file for excluding the temporary,
vendor specific, and templates files, instead of writing our own logic to do so. Patch by: Anthony & Joao Reviewed by: Khushboo
This commit is contained in:
parent
bd356ff9fa
commit
a7ee85619d
5
web/.eslintignore
Normal file
5
web/.eslintignore
Normal file
@ -0,0 +1,5 @@
|
||||
generated
|
||||
node_modules
|
||||
vendor
|
||||
templates/
|
||||
templates\
|
@ -91,7 +91,7 @@
|
||||
"webcabin-docker": "git+https://github.com/EnterpriseDB/wcDocker"
|
||||
},
|
||||
"scripts": {
|
||||
"linter": "node pga_eslint.js",
|
||||
"linter": "yarn eslint --no-eslintrc -c .eslintrc.js --ext .js --ext .jsx .",
|
||||
"webpacker": "yarn run webpack --config webpack.config.js --progress",
|
||||
"webpacker:watch": "yarn run webpack --config webpack.config.js --progress --watch",
|
||||
"bundle:watch": "yarn run linter && yarn run webpacker:watch",
|
||||
|
@ -1,44 +0,0 @@
|
||||
#!/usr/bin/env node
|
||||
|
||||
/* eslint no-console:off */
|
||||
/* eslint no-undef:off */
|
||||
'use strict';
|
||||
|
||||
const debug = (process.argv.indexOf('--debug') > -1),
|
||||
file_argv = process.argv.indexOf('--file');
|
||||
var argv = process.argv;
|
||||
|
||||
if (file_argv > -1) {
|
||||
argv.splice(file_argv, 1);
|
||||
} else {
|
||||
argv = argv.concat(['--ignore-pattern', __filename]);
|
||||
}
|
||||
|
||||
// must do this initialization *before* other requires in order to work
|
||||
if (debug) {
|
||||
require('debug').enable('eslint:*,-eslint:code-path');
|
||||
}
|
||||
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
const read = (dir) =>
|
||||
fs.readdirSync(dir)
|
||||
.reduce((files, file) =>
|
||||
fs.statSync(path.join(dir, file)).isDirectory() ?
|
||||
files.concat(read(path.join(dir, file))) :
|
||||
((file, files) => (
|
||||
file.indexOf(path.sep + 'generated' + path.sep) === -1 &&
|
||||
file.indexOf(path.sep + 'vendor' + path.sep) === -1 &&
|
||||
file.indexOf(path.sep + 'static' + path.sep) > -1 &&
|
||||
(file.endsWith('.js') || file.endsWith('.jsx')) &&
|
||||
files.concat(file) || files
|
||||
))(path.join(dir, file), files), []),
|
||||
eslint_cli = require('eslint/lib/cli');
|
||||
|
||||
process.exitCode = eslint_cli.execute(
|
||||
file_argv > -1 ? argv : argv.concat(
|
||||
read(path.join(__dirname, 'pgadmin'))
|
||||
).concat(
|
||||
['regression/javascript/**/*.jsx','regression/javascript/**/*.js','*.js']
|
||||
)
|
||||
);
|
Loading…
Reference in New Issue
Block a user