mirror of
https://github.com/easingthemes/ssh-deploy
synced 2026-04-06 04:43:02 +08:00
chore: upgrade all devDependencies and migrate to eslint 10 flat config
- Upgrade eslint 8.31 → 10.1 with new flat config (eslint.config.js)
- Upgrade @vercel/ncc 0.36 → 0.38.4
- Replace eslint-config-airbnb-base + eslint-plugin-import with @eslint/js + @stylistic/eslint-plugin
- Remove stale overrides (word-wrap, semver) that patched eslint 8 transitive deps
- Remove obsolete eslint-disable comments from source files
- Add { cause } to rethrown error in rsyncCli.js
- Resolves all 3 npm audit vulnerabilities (flatted, minimatch, js-yaml)
This commit is contained in:
25
.eslintrc.js
25
.eslintrc.js
@@ -1,25 +0,0 @@
|
|||||||
module.exports = {
|
|
||||||
env: {
|
|
||||||
commonjs: true,
|
|
||||||
es6: true,
|
|
||||||
node: true
|
|
||||||
},
|
|
||||||
extends: [
|
|
||||||
'airbnb-base'
|
|
||||||
],
|
|
||||||
globals: {
|
|
||||||
Atomics: 'readonly',
|
|
||||||
SharedArrayBuffer: 'readonly'
|
|
||||||
},
|
|
||||||
parserOptions: {
|
|
||||||
ecmaVersion: 2018
|
|
||||||
},
|
|
||||||
rules: {
|
|
||||||
'comma-dangle': [
|
|
||||||
'error',
|
|
||||||
'never'
|
|
||||||
],
|
|
||||||
'no-console': 'off',
|
|
||||||
'object-curly-newline': 'off'
|
|
||||||
}
|
|
||||||
};
|
|
||||||
2
dist/index.js
vendored
2
dist/index.js
vendored
File diff suppressed because one or more lines are too long
52
eslint.config.js
Normal file
52
eslint.config.js
Normal file
@@ -0,0 +1,52 @@
|
|||||||
|
const js = require('@eslint/js');
|
||||||
|
const stylistic = require('@stylistic/eslint-plugin');
|
||||||
|
const globals = require('globals');
|
||||||
|
|
||||||
|
module.exports = [
|
||||||
|
js.configs.recommended,
|
||||||
|
{
|
||||||
|
plugins: {
|
||||||
|
'@stylistic': stylistic
|
||||||
|
},
|
||||||
|
languageOptions: {
|
||||||
|
ecmaVersion: 2020,
|
||||||
|
sourceType: 'commonjs',
|
||||||
|
globals: {
|
||||||
|
...globals.node,
|
||||||
|
...globals.commonjs,
|
||||||
|
...globals.es2020,
|
||||||
|
Atomics: 'readonly',
|
||||||
|
SharedArrayBuffer: 'readonly'
|
||||||
|
}
|
||||||
|
},
|
||||||
|
rules: {
|
||||||
|
// Stylistic rules (migrated from airbnb-base)
|
||||||
|
'@stylistic/comma-dangle': ['error', 'never'],
|
||||||
|
'@stylistic/indent': ['error', 2, { SwitchCase: 1 }],
|
||||||
|
'@stylistic/semi': ['error', 'always'],
|
||||||
|
'@stylistic/quotes': ['error', 'single', { avoidEscape: true }],
|
||||||
|
'@stylistic/arrow-parens': ['error', 'always'],
|
||||||
|
'@stylistic/brace-style': ['error', '1tbs', { allowSingleLine: true }],
|
||||||
|
'@stylistic/comma-spacing': ['error', { before: false, after: true }],
|
||||||
|
'@stylistic/key-spacing': ['error', { beforeColon: false, afterColon: true }],
|
||||||
|
'@stylistic/keyword-spacing': ['error', { before: true, after: true }],
|
||||||
|
'@stylistic/eol-last': ['error', 'always'],
|
||||||
|
'@stylistic/no-trailing-spaces': 'error',
|
||||||
|
'@stylistic/space-before-blocks': 'error',
|
||||||
|
'@stylistic/space-infix-ops': 'error',
|
||||||
|
'@stylistic/arrow-spacing': ['error', { before: true, after: true }],
|
||||||
|
|
||||||
|
// JS rules (migrated from airbnb-base)
|
||||||
|
'no-console': 'off',
|
||||||
|
'no-var': 'error',
|
||||||
|
'prefer-const': 'error',
|
||||||
|
'prefer-arrow-callback': 'error',
|
||||||
|
'prefer-template': 'error',
|
||||||
|
'object-shorthand': ['error', 'always'],
|
||||||
|
'no-shadow': 'error',
|
||||||
|
'no-use-before-define': ['error', { functions: true, classes: true, variables: true }],
|
||||||
|
'camelcase': ['error', { properties: 'never' }],
|
||||||
|
'no-unused-vars': ['error', { vars: 'all', args: 'after-used', ignoreRestSiblings: true }]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
];
|
||||||
3187
package-lock.json
generated
3187
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
13
package.json
13
package.json
@@ -30,13 +30,10 @@
|
|||||||
},
|
},
|
||||||
"homepage": "https://github.com/easingthemes/ssh-deploy#readme",
|
"homepage": "https://github.com/easingthemes/ssh-deploy#readme",
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@vercel/ncc": "^0.36.0",
|
"@eslint/js": "^10.0.1",
|
||||||
"eslint": "^8.30.0",
|
"@stylistic/eslint-plugin": "^5.10.0",
|
||||||
"eslint-config-airbnb-base": "^15.0.0",
|
"@vercel/ncc": "^0.38.4",
|
||||||
"eslint-plugin-import": "^2.26.0"
|
"eslint": "^10.1.0",
|
||||||
},
|
"globals": "^17.4.0"
|
||||||
"overrides": {
|
|
||||||
"word-wrap": "npm:@aashutoshrathi/word-wrap@1.2.5",
|
|
||||||
"semver": "^7.5.2"
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -27,7 +27,6 @@ const run = async () => {
|
|||||||
if (scriptBefore) {
|
if (scriptBefore) {
|
||||||
await remoteCmdBefore(scriptBefore, privateKeyPath, scriptBeforeRequired);
|
await remoteCmdBefore(scriptBefore, privateKeyPath, scriptBeforeRequired);
|
||||||
}
|
}
|
||||||
/* eslint-disable object-property-newline */
|
|
||||||
await sshDeploy({
|
await sshDeploy({
|
||||||
source, rsyncServer, exclude, remotePort,
|
source, rsyncServer, exclude, remotePort,
|
||||||
privateKeyPath, args, sshCmdArgs
|
privateKeyPath, args, sshCmdArgs
|
||||||
|
|||||||
@@ -27,7 +27,6 @@ inputNames.forEach((input) => {
|
|||||||
const inputVal = process.env[input] || process.env[`INPUT_${input}`] || defaultInputs[inputName];
|
const inputVal = process.env[input] || process.env[`INPUT_${input}`] || defaultInputs[inputName];
|
||||||
const validVal = inputVal === undefined ? defaultInputs[inputName] : inputVal;
|
const validVal = inputVal === undefined ? defaultInputs[inputName] : inputVal;
|
||||||
let extendedVal = validVal;
|
let extendedVal = validVal;
|
||||||
// eslint-disable-next-line default-case
|
|
||||||
switch (inputName) {
|
switch (inputName) {
|
||||||
case 'source':
|
case 'source':
|
||||||
extendedVal = validVal.split(' ').map((src) => `${githubWorkspace}/${src}`);
|
extendedVal = validVal.split(' ').map((src) => `${githubWorkspace}/${src}`);
|
||||||
|
|||||||
@@ -11,7 +11,6 @@ const handleError = (message, isRequired, callback) => {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
// eslint-disable-next-line max-len
|
|
||||||
const remoteCmd = async (content, privateKeyPath, isRequired, label) => new Promise((resolve, reject) => {
|
const remoteCmd = async (content, privateKeyPath, isRequired, label) => new Promise((resolve, reject) => {
|
||||||
const uuid = crypto.randomUUID();
|
const uuid = crypto.randomUUID();
|
||||||
const filename = `local_ssh_script-${label}-${uuid}.sh`;
|
const filename = `local_ssh_script-${label}-${uuid}.sh`;
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ const validateRsync = async () => {
|
|||||||
execSync('sudo DEBIAN_FRONTEND=noninteractive apt-get -y update && sudo DEBIAN_FRONTEND=noninteractive apt-get --no-install-recommends -y install rsync', { stdio: 'inherit' });
|
execSync('sudo DEBIAN_FRONTEND=noninteractive apt-get -y update && sudo DEBIAN_FRONTEND=noninteractive apt-get --no-install-recommends -y install rsync', { stdio: 'inherit' });
|
||||||
console.log('✅ [CLI] Rsync installed. \n');
|
console.log('✅ [CLI] Rsync installed. \n');
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
throw new Error(`⚠️ [CLI] Rsync installation failed. Aborting ... error: ${error.message}`);
|
throw new Error(`⚠️ [CLI] Rsync installation failed. Aborting ... error: ${error.message}`, { cause: error });
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -65,7 +65,6 @@ const rsyncCli = async ({
|
|||||||
};
|
};
|
||||||
|
|
||||||
// RSYNC COMMAND
|
// RSYNC COMMAND
|
||||||
/* eslint-disable object-property-newline */
|
|
||||||
return nodeRsyncPromise({
|
return nodeRsyncPromise({
|
||||||
...defaultOptions,
|
...defaultOptions,
|
||||||
src: source, dest: rsyncServer, excludeFirst: exclude, port: remotePort,
|
src: source, dest: rsyncServer, excludeFirst: exclude, port: remotePort,
|
||||||
|
|||||||
Reference in New Issue
Block a user