refactor: Upgrade to eslint 9.19.0 (#9580)
This commit is contained in:
@@ -1,3 +0,0 @@
|
|||||||
lib
|
|
||||||
coverage
|
|
||||||
out
|
|
||||||
@@ -1,35 +0,0 @@
|
|||||||
{
|
|
||||||
"root": true,
|
|
||||||
"extends": "eslint:recommended",
|
|
||||||
"env": {
|
|
||||||
"node": true,
|
|
||||||
"es6": true
|
|
||||||
},
|
|
||||||
"parser": "@babel/eslint-parser",
|
|
||||||
"plugins": [
|
|
||||||
"flowtype"
|
|
||||||
],
|
|
||||||
"parserOptions": {
|
|
||||||
"ecmaVersion": 6,
|
|
||||||
"sourceType": "module",
|
|
||||||
"requireConfigFile": false
|
|
||||||
},
|
|
||||||
"rules": {
|
|
||||||
"indent": ["error", 2, { "SwitchCase": 1 }],
|
|
||||||
"linebreak-style": ["error", "unix"],
|
|
||||||
"no-trailing-spaces": 2,
|
|
||||||
"eol-last": 2,
|
|
||||||
"space-in-parens": ["error", "never"],
|
|
||||||
"no-multiple-empty-lines": 1,
|
|
||||||
"prefer-const": "error",
|
|
||||||
"space-infix-ops": "error",
|
|
||||||
"no-useless-escape": "off",
|
|
||||||
"require-atomic-updates": "off",
|
|
||||||
"object-curly-spacing": ["error", "always"],
|
|
||||||
"curly": ["error", "all"],
|
|
||||||
"block-spacing": ["error", "always"]
|
|
||||||
},
|
|
||||||
"globals": {
|
|
||||||
"Parse": true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -30,10 +30,12 @@ async function config() {
|
|||||||
|
|
||||||
// Get branch
|
// Get branch
|
||||||
const branch = ref?.split('/')?.pop()?.split('-')[0] || '(current branch could not be determined)';
|
const branch = ref?.split('/')?.pop()?.split('-')[0] || '(current branch could not be determined)';
|
||||||
|
// eslint-disable-next-line no-console
|
||||||
console.log(`Running on branch: ${branch}`);
|
console.log(`Running on branch: ${branch}`);
|
||||||
|
|
||||||
// Set changelog file
|
// Set changelog file
|
||||||
const changelogFile = `./changelogs/CHANGELOG_${branch}.md`;
|
const changelogFile = `./changelogs/CHANGELOG_${branch}.md`;
|
||||||
|
// eslint-disable-next-line no-console
|
||||||
console.log(`Changelog file output to: ${changelogFile}`);
|
console.log(`Changelog file output to: ${changelogFile}`);
|
||||||
|
|
||||||
// Load template file contents
|
// Load template file contents
|
||||||
@@ -108,7 +110,7 @@ async function config() {
|
|||||||
|
|
||||||
async function loadTemplates() {
|
async function loadTemplates() {
|
||||||
for (const template of Object.keys(templates)) {
|
for (const template of Object.keys(templates)) {
|
||||||
|
|
||||||
// For ES6 modules use:
|
// For ES6 modules use:
|
||||||
// const fileUrl = import.meta.url;
|
// const fileUrl = import.meta.url;
|
||||||
// const __dirname = dirname(fileURLToPath(fileUrl));
|
// const __dirname = dirname(fileURLToPath(fileUrl));
|
||||||
|
|||||||
@@ -220,6 +220,7 @@ class CiVersionCheck {
|
|||||||
* Runs the check.
|
* Runs the check.
|
||||||
*/
|
*/
|
||||||
async check() {
|
async check() {
|
||||||
|
/* eslint-disable no-console */
|
||||||
try {
|
try {
|
||||||
console.log(`\nChecking ${this.packageName} versions in CI environments...`);
|
console.log(`\nChecking ${this.packageName} versions in CI environments...`);
|
||||||
|
|
||||||
@@ -284,6 +285,7 @@ class CiVersionCheck {
|
|||||||
const msg = `Failed to check ${this.packageName} versions with error: ${e}`;
|
const msg = `Failed to check ${this.packageName} versions with error: ${e}`;
|
||||||
core.setFailed(msg);
|
core.setFailed(msg);
|
||||||
}
|
}
|
||||||
|
/* eslint-enable no-console */
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ const util = require('util');
|
|||||||
fs.readFile('./src/Options/docs.js', 'utf8'),
|
fs.readFile('./src/Options/docs.js', 'utf8'),
|
||||||
]);
|
]);
|
||||||
if (currentDefinitions !== newDefinitions || currentDocs !== newDocs) {
|
if (currentDefinitions !== newDefinitions || currentDocs !== newDocs) {
|
||||||
|
// eslint-disable-next-line no-console
|
||||||
console.error(
|
console.error(
|
||||||
'\x1b[31m%s\x1b[0m',
|
'\x1b[31m%s\x1b[0m',
|
||||||
'Definitions files cannot be updated manually. Please update src/Options/index.js then run `npm run definitions` to generate definitions.'
|
'Definitions files cannot be updated manually. Please update src/Options/index.js then run `npm run definitions` to generate definitions.'
|
||||||
|
|||||||
@@ -87,6 +87,7 @@ class NodeEngineCheck {
|
|||||||
nodeVersion: version
|
nodeVersion: version
|
||||||
});
|
});
|
||||||
} catch(e) {
|
} catch(e) {
|
||||||
|
// eslint-disable-next-line no-console
|
||||||
console.log(`Ignoring file because it is not valid JSON: ${file}`);
|
console.log(`Ignoring file because it is not valid JSON: ${file}`);
|
||||||
core.warning(`Ignoring file because it is not valid JSON: ${file}`);
|
core.warning(`Ignoring file because it is not valid JSON: ${file}`);
|
||||||
}
|
}
|
||||||
@@ -171,6 +172,7 @@ async function check() {
|
|||||||
// Get highest version
|
// Get highest version
|
||||||
const highestVersion = higherVersions.map(v => v.nodeMinVersion).pop();
|
const highestVersion = higherVersions.map(v => v.nodeMinVersion).pop();
|
||||||
|
|
||||||
|
/* eslint-disable no-console */
|
||||||
// If there are higher versions
|
// If there are higher versions
|
||||||
if (higherVersions.length > 0) {
|
if (higherVersions.length > 0) {
|
||||||
console.log(`\nThere are ${higherVersions.length} dependencies that require a higher node engine version than the parent package (${parentVersion.nodeVersion}):`);
|
console.log(`\nThere are ${higherVersions.length} dependencies that require a higher node engine version than the parent package (${parentVersion.nodeVersion}):`);
|
||||||
@@ -189,6 +191,7 @@ async function check() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
console.log(`✅ All dependencies satisfy the node version requirement of the parent package (${parentVersion.nodeVersion}).`);
|
console.log(`✅ All dependencies satisfy the node version requirement of the parent package (${parentVersion.nodeVersion}).`);
|
||||||
|
/* eslint-enable no-console */
|
||||||
}
|
}
|
||||||
|
|
||||||
check();
|
check();
|
||||||
|
|||||||
40
eslint.config.js
Normal file
40
eslint.config.js
Normal file
@@ -0,0 +1,40 @@
|
|||||||
|
const js = require("@eslint/js");
|
||||||
|
const babelParser = require("@babel/eslint-parser");
|
||||||
|
const globals = require("globals");
|
||||||
|
module.exports = [
|
||||||
|
{
|
||||||
|
ignores: ["**/lib/**", "**/coverage/**", "**/out/**"],
|
||||||
|
},
|
||||||
|
js.configs.recommended,
|
||||||
|
{
|
||||||
|
languageOptions: {
|
||||||
|
parser: babelParser,
|
||||||
|
ecmaVersion: 6,
|
||||||
|
sourceType: "module",
|
||||||
|
globals: {
|
||||||
|
Parse: "readonly",
|
||||||
|
...globals.node,
|
||||||
|
},
|
||||||
|
parserOptions: {
|
||||||
|
requireConfigFile: false,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
rules: {
|
||||||
|
indent: ["error", 2, { SwitchCase: 1 }],
|
||||||
|
"linebreak-style": ["error", "unix"],
|
||||||
|
"no-trailing-spaces": "error",
|
||||||
|
"eol-last": "error",
|
||||||
|
"space-in-parens": ["error", "never"],
|
||||||
|
"no-multiple-empty-lines": "warn",
|
||||||
|
"prefer-const": "error",
|
||||||
|
"space-infix-ops": "error",
|
||||||
|
"no-useless-escape": "off",
|
||||||
|
"require-atomic-updates": "off",
|
||||||
|
"object-curly-spacing": ["error", "always"],
|
||||||
|
curly: ["error", "all"],
|
||||||
|
"block-spacing": ["error", "always"],
|
||||||
|
"no-unused-vars": "off",
|
||||||
|
"no-console": "warn"
|
||||||
|
},
|
||||||
|
},
|
||||||
|
];
|
||||||
1821
package-lock.json
generated
1821
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@@ -88,10 +88,10 @@
|
|||||||
"clean-jsdoc-theme": "4.3.0",
|
"clean-jsdoc-theme": "4.3.0",
|
||||||
"cross-env": "7.0.3",
|
"cross-env": "7.0.3",
|
||||||
"deep-diff": "1.0.2",
|
"deep-diff": "1.0.2",
|
||||||
"eslint": "8.57.0",
|
"eslint": "9.19.0",
|
||||||
"eslint-plugin-flowtype": "8.0.3",
|
|
||||||
"flow-bin": "0.119.1",
|
"flow-bin": "0.119.1",
|
||||||
"form-data": "4.0.1",
|
"form-data": "4.0.1",
|
||||||
|
"globals": "15.14.0",
|
||||||
"graphql-tag": "2.12.6",
|
"graphql-tag": "2.12.6",
|
||||||
"husky": "9.1.7",
|
"husky": "9.1.7",
|
||||||
"jasmine": "3.5.0",
|
"jasmine": "3.5.0",
|
||||||
@@ -118,8 +118,8 @@
|
|||||||
"ci:definitionsCheck": "node ./ci/definitionsCheck.js",
|
"ci:definitionsCheck": "node ./ci/definitionsCheck.js",
|
||||||
"definitions": "node ./resources/buildConfigDefinitions.js && prettier --write 'src/Options/*.js'",
|
"definitions": "node ./resources/buildConfigDefinitions.js && prettier --write 'src/Options/*.js'",
|
||||||
"docs": "jsdoc -c ./jsdoc-conf.json",
|
"docs": "jsdoc -c ./jsdoc-conf.json",
|
||||||
"lint": "eslint --cache ./",
|
"lint": "eslint --cache ./ --flag unstable_config_lookup_from_file",
|
||||||
"lint-fix": "eslint --fix --cache ./",
|
"lint-fix": "eslint --fix --cache ./ --flag unstable_config_lookup_from_file",
|
||||||
"build": "babel src/ -d lib/ --copy-files --extensions '.ts,.js'",
|
"build": "babel src/ -d lib/ --copy-files --extensions '.ts,.js'",
|
||||||
"build:types": "tsc",
|
"build:types": "tsc",
|
||||||
"watch": "babel --watch src/ -d lib/ --copy-files",
|
"watch": "babel --watch src/ -d lib/ --copy-files",
|
||||||
|
|||||||
@@ -1,45 +0,0 @@
|
|||||||
{
|
|
||||||
"env": {
|
|
||||||
"jasmine": true
|
|
||||||
},
|
|
||||||
"globals": {
|
|
||||||
"Parse": true,
|
|
||||||
"reconfigureServer": true,
|
|
||||||
"createTestUser": true,
|
|
||||||
"jfail": true,
|
|
||||||
"ok": true,
|
|
||||||
"strictEqual": true,
|
|
||||||
"TestObject": true,
|
|
||||||
"Item": true,
|
|
||||||
"Container": true,
|
|
||||||
"equal": true,
|
|
||||||
"expectAsync": true,
|
|
||||||
"notEqual": true,
|
|
||||||
"it_id": true,
|
|
||||||
"fit_id": true,
|
|
||||||
"it_only_db": true,
|
|
||||||
"it_only_mongodb_version": true,
|
|
||||||
"it_only_postgres_version": true,
|
|
||||||
"it_only_node_version": true,
|
|
||||||
"fit_only_mongodb_version": true,
|
|
||||||
"fit_only_postgres_version": true,
|
|
||||||
"fit_only_node_version": true,
|
|
||||||
"it_exclude_dbs": true,
|
|
||||||
"fit_exclude_dbs": true,
|
|
||||||
"describe_only_db": true,
|
|
||||||
"fdescribe_only_db": true,
|
|
||||||
"describe_only": true,
|
|
||||||
"on_db": true,
|
|
||||||
"defaultConfiguration": true,
|
|
||||||
"range": true,
|
|
||||||
"jequal": true,
|
|
||||||
"create": true,
|
|
||||||
"arrayContains": true,
|
|
||||||
"databaseAdapter": true,
|
|
||||||
"databaseURI": true
|
|
||||||
},
|
|
||||||
"rules": {
|
|
||||||
"no-console": [0],
|
|
||||||
"no-var": "error"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
55
spec/eslint.config.js
Normal file
55
spec/eslint.config.js
Normal file
@@ -0,0 +1,55 @@
|
|||||||
|
const js = require("@eslint/js");
|
||||||
|
const globals = require("globals");
|
||||||
|
module.exports = [
|
||||||
|
js.configs.recommended,
|
||||||
|
{
|
||||||
|
languageOptions: {
|
||||||
|
ecmaVersion: "latest",
|
||||||
|
sourceType: "module",
|
||||||
|
globals: {
|
||||||
|
...globals.node,
|
||||||
|
...globals.jasmine,
|
||||||
|
Parse: "readonly",
|
||||||
|
reconfigureServer: "readonly",
|
||||||
|
createTestUser: "readonly",
|
||||||
|
jfail: "readonly",
|
||||||
|
ok: "readonly",
|
||||||
|
strictEqual: "readonly",
|
||||||
|
TestObject: "readonly",
|
||||||
|
Item: "readonly",
|
||||||
|
Container: "readonly",
|
||||||
|
equal: "readonly",
|
||||||
|
expectAsync: "readonly",
|
||||||
|
notEqual: "readonly",
|
||||||
|
it_id: "readonly",
|
||||||
|
fit_id: "readonly",
|
||||||
|
it_only_db: "readonly",
|
||||||
|
it_only_mongodb_version: "readonly",
|
||||||
|
it_only_postgres_version: "readonly",
|
||||||
|
it_only_node_version: "readonly",
|
||||||
|
fit_only_mongodb_version: "readonly",
|
||||||
|
fit_only_postgres_version: "readonly",
|
||||||
|
fit_only_node_version: "readonly",
|
||||||
|
it_exclude_dbs: "readonly",
|
||||||
|
fit_exclude_dbs: "readonly",
|
||||||
|
describe_only_db: "readonly",
|
||||||
|
fdescribe_only_db: "readonly",
|
||||||
|
describe_only: "readonly",
|
||||||
|
on_db: "readonly",
|
||||||
|
defaultConfiguration: "readonly",
|
||||||
|
range: "readonly",
|
||||||
|
jequal: "readonly",
|
||||||
|
create: "readonly",
|
||||||
|
arrayContains: "readonly",
|
||||||
|
databaseAdapter: "readonly",
|
||||||
|
databaseURI: "readonly"
|
||||||
|
},
|
||||||
|
},
|
||||||
|
rules: {
|
||||||
|
"no-console": "off",
|
||||||
|
"no-var": "error",
|
||||||
|
"no-unused-vars": "off",
|
||||||
|
"no-useless-escape": "off",
|
||||||
|
}
|
||||||
|
},
|
||||||
|
];
|
||||||
@@ -119,4 +119,4 @@ global.retryFlakyTests = function() {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = CurrentSpecReporter;
|
module.exports = CurrentSpecReporter;
|
||||||
@@ -28,7 +28,6 @@ export function loadAdapter<T>(adapter, defaultAdapter, options): T {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (typeof adapter === 'string') {
|
} else if (typeof adapter === 'string') {
|
||||||
/* eslint-disable */
|
|
||||||
adapter = require(adapter);
|
adapter = require(adapter);
|
||||||
// If it's define as a module, get the default
|
// If it's define as a module, get the default
|
||||||
if (adapter.default) {
|
if (adapter.default) {
|
||||||
|
|||||||
@@ -189,9 +189,7 @@ const handleDotFields = object => {
|
|||||||
if (value && value.__op === 'Delete') {
|
if (value && value.__op === 'Delete') {
|
||||||
value = undefined;
|
value = undefined;
|
||||||
}
|
}
|
||||||
/* eslint-disable no-cond-assign */
|
|
||||||
while ((next = components.shift())) {
|
while ((next = components.shift())) {
|
||||||
/* eslint-enable no-cond-assign */
|
|
||||||
currentObj[next] = currentObj[next] || {};
|
currentObj[next] = currentObj[next] || {};
|
||||||
if (components.length === 0) {
|
if (components.length === 0) {
|
||||||
currentObj[next] = value;
|
currentObj[next] = value;
|
||||||
@@ -819,6 +817,7 @@ const buildWhereClause = ({ schema, query, index, caseInsensitive }): WhereClaus
|
|||||||
if (parserResult.status === 'success') {
|
if (parserResult.status === 'success') {
|
||||||
postgresValue = toPostgresValue(parserResult.result);
|
postgresValue = toPostgresValue(parserResult.result);
|
||||||
} else {
|
} else {
|
||||||
|
// eslint-disable-next-line no-console
|
||||||
console.error('Error while parsing relative date', parserResult);
|
console.error('Error while parsing relative date', parserResult);
|
||||||
throw new Parse.Error(
|
throw new Parse.Error(
|
||||||
Parse.Error.INVALID_JSON,
|
Parse.Error.INVALID_JSON,
|
||||||
@@ -917,6 +916,7 @@ export class PostgresStorageAdapter implements StorageAdapter {
|
|||||||
this._stream
|
this._stream
|
||||||
.none('NOTIFY $1~, $2', ['schema.change', { senderId: this._uuid }])
|
.none('NOTIFY $1~, $2', ['schema.change', { senderId: this._uuid }])
|
||||||
.catch(error => {
|
.catch(error => {
|
||||||
|
// eslint-disable-next-line no-console
|
||||||
console.log('Failed to Notify:', error); // unlikely to ever happen
|
console.log('Failed to Notify:', error); // unlikely to ever happen
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -2376,7 +2376,7 @@ export class PostgresStorageAdapter implements StorageAdapter {
|
|||||||
debug(`initializationDone in ${ctx.duration}`);
|
debug(`initializationDone in ${ctx.duration}`);
|
||||||
})
|
})
|
||||||
.catch(error => {
|
.catch(error => {
|
||||||
/* eslint-disable no-console */
|
// eslint-disable-next-line no-console
|
||||||
console.error(error);
|
console.error(error);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -50,6 +50,7 @@ const getObject = async (
|
|||||||
options.keys = keys;
|
options.keys = keys;
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
// eslint-disable-next-line no-console
|
||||||
console.error(e);
|
console.error(e);
|
||||||
}
|
}
|
||||||
if (include) {
|
if (include) {
|
||||||
|
|||||||
@@ -201,6 +201,7 @@ class ParseServer {
|
|||||||
Config.put(this.config);
|
Config.put(this.config);
|
||||||
return this;
|
return this;
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
// eslint-disable-next-line no-console
|
||||||
console.error(error);
|
console.error(error);
|
||||||
this.config.state = 'error';
|
this.config.state = 'error';
|
||||||
throw error;
|
throw error;
|
||||||
@@ -370,6 +371,7 @@ class ParseServer {
|
|||||||
try {
|
try {
|
||||||
await this.start();
|
await this.start();
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
// eslint-disable-next-line no-console
|
||||||
console.error('Error on ParseServer.startApp: ', e);
|
console.error('Error on ParseServer.startApp: ', e);
|
||||||
throw e;
|
throw e;
|
||||||
}
|
}
|
||||||
@@ -482,6 +484,7 @@ class ParseServer {
|
|||||||
};
|
};
|
||||||
const url = `${Parse.serverURL.replace(/\/$/, '')}/health`;
|
const url = `${Parse.serverURL.replace(/\/$/, '')}/health`;
|
||||||
if (!isValidHttpUrl(url)) {
|
if (!isValidHttpUrl(url)) {
|
||||||
|
// eslint-disable-next-line no-console
|
||||||
console.warn(
|
console.warn(
|
||||||
`\nWARNING, Unable to connect to '${Parse.serverURL}' as the URL is invalid.` +
|
`\nWARNING, Unable to connect to '${Parse.serverURL}' as the URL is invalid.` +
|
||||||
` Cloud code and push notifications may be unavailable!\n`
|
` Cloud code and push notifications may be unavailable!\n`
|
||||||
@@ -543,6 +546,7 @@ function injectDefaults(options: ParseServerOptions) {
|
|||||||
if (options.appId) {
|
if (options.appId) {
|
||||||
const regex = /[!#$%'()*+&/:;=?@[\]{}^,|<>]/g;
|
const regex = /[!#$%'()*+&/:;=?@[\]{}^,|<>]/g;
|
||||||
if (options.appId.match(regex)) {
|
if (options.appId.match(regex)) {
|
||||||
|
// eslint-disable-next-line no-console
|
||||||
console.warn(
|
console.warn(
|
||||||
`\nWARNING, appId that contains special characters can cause issues while using with urls.\n`
|
`\nWARNING, appId that contains special characters can cause issues while using with urls.\n`
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -387,7 +387,7 @@ export class DefinedSchemas {
|
|||||||
logger.warn(`classLevelPermissions not provided for ${localSchema.className}.`);
|
logger.warn(`classLevelPermissions not provided for ${localSchema.className}.`);
|
||||||
}
|
}
|
||||||
// Use spread to avoid read only issue (encountered by Moumouls using directAccess)
|
// Use spread to avoid read only issue (encountered by Moumouls using directAccess)
|
||||||
const clp = ({ ...localSchema.classLevelPermissions } || {}: Parse.CLP.PermissionsMap);
|
const clp = ({ ...localSchema.classLevelPermissions || {} }: Parse.CLP.PermissionsMap);
|
||||||
// To avoid inconsistency we need to remove all rights on addField
|
// To avoid inconsistency we need to remove all rights on addField
|
||||||
clp.addField = {};
|
clp.addField = {};
|
||||||
newLocalSchema.setCLP(clp);
|
newLocalSchema.setCLP(clp);
|
||||||
|
|||||||
2
src/vendor/mongodbUrl.js
vendored
2
src/vendor/mongodbUrl.js
vendored
@@ -505,7 +505,7 @@ function urlFormat(obj) {
|
|||||||
if (typeof obj === 'string') { obj = urlParse(obj); }
|
if (typeof obj === 'string') { obj = urlParse(obj); }
|
||||||
else if (typeof obj !== 'object' || obj === null)
|
else if (typeof obj !== 'object' || obj === null)
|
||||||
{ throw new TypeError(
|
{ throw new TypeError(
|
||||||
'Parameter "urlObj" must be an object, not ' + obj === null ? 'null' : typeof obj
|
'Parameter "urlObj" must be an object, not ' + (obj === null ? 'null' : typeof obj)
|
||||||
); }
|
); }
|
||||||
else if (!(obj instanceof Url)) { return Url.prototype.format.call(obj); }
|
else if (!(obj instanceof Url)) { return Url.prototype.format.call(obj); }
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user