Skip to content

Commit 8e560ea

Browse files
Improved linting (#13)
1 parent bba629c commit 8e560ea

5 files changed

Lines changed: 22 additions & 11 deletions

File tree

components/framework/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -328,7 +328,7 @@ class ServerlessFramework {
328328
const { stdout: infoOutput } = await this.exec('serverless', ['info', '--verbose']);
329329
try {
330330
return YAML.load(infoOutput.toString())['Stack Outputs'];
331-
} catch (e) {
331+
} catch {
332332
if (infoOutput.toString()) {
333333
// Try to extract the section with `Stack Outputs` and parse it
334334
// The regex below matches everything indented with 2 spaces below "Stack Outputs:"

eslint.config.js

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ module.exports = [
2929
importX.flatConfigs.recommended,
3030
eslintConfigPrettier,
3131
{
32-
files: ['**/*.{cjs,js,mjs}'],
32+
files: ['**/*.{cjs,js,mjs}', 'bin/serverless-compose'],
3333
languageOptions: {
3434
ecmaVersion: 2023,
3535
sourceType: 'commonjs',
@@ -46,7 +46,12 @@ module.exports = [
4646
},
4747
],
4848
'import-x/no-unresolved': ['error', { commonjs: true }],
49-
'no-unused-vars': ['error', { caughtErrors: 'none' }],
49+
'no-unused-vars': [
50+
'error',
51+
{
52+
caughtErrors: 'all',
53+
},
54+
],
5055
'n/no-unsupported-features/node-builtins': ['error', { allowExperimental: true }],
5156
'n/no-extraneous-require': 'off',
5257
'n/no-unpublished-require': 'off',
@@ -56,6 +61,12 @@ module.exports = [
5661
'n/hashbang': 'off',
5762
},
5863
},
64+
{
65+
files: ['bin/serverless-compose', 'components/**/*.js', 'src/**/*.js'],
66+
rules: {
67+
'n/no-unpublished-require': 'error',
68+
},
69+
},
5970
{
6071
files: ['**/*.mjs'],
6172
languageOptions: {

package.json

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,12 @@
1212
"oslsc": "bin/serverless-compose"
1313
},
1414
"scripts": {
15-
"lint": "eslint .",
16-
"lint:updated": "pipe-git-updated --ext=cjs --ext=js --ext=mjs --base=main -- eslint",
17-
"prettier-check": "prettier -c \"**/*.{cjs,css,html,js,json,md,mjs,yaml,yml}\"",
18-
"prettier-check:updated": "pipe-git-updated --ext=cjs --ext=css --ext=html --ext=js --ext=json --ext=md --ext=mjs --ext=yaml --ext=yml --base=main -- prettier -c",
19-
"prettify": "prettier --write \"**/*.{cjs,css,html,js,json,md,mjs,yaml,yml}\"",
20-
"prettify:updated": "pipe-git-updated --ext=cjs --ext=css --ext=html --ext=js --ext=json --ext=md --ext=mjs --ext=yaml --ext=yml --base=main -- prettier --write",
15+
"lint": "eslint . bin/serverless-compose",
16+
"lint:updated": "pipe-git-updated --ext=cjs --ext=js --ext=mjs --base=main -- eslint && pipe-git-updated --base=main bin -- eslint",
17+
"prettier-check": "prettier -c \"**/*.{cjs,css,html,js,json,md,mjs,yaml,yml}\" && prettier -c --parser babel bin/serverless-compose",
18+
"prettier-check:updated": "pipe-git-updated --ext=cjs --ext=css --ext=html --ext=js --ext=json --ext=md --ext=mjs --ext=yaml --ext=yml --base=main -- prettier -c && pipe-git-updated --base=main bin -- prettier -c --parser=babel",
19+
"prettify": "prettier --write \"**/*.{cjs,css,html,js,json,md,mjs,yaml,yml}\" && prettier --write --parser babel bin/serverless-compose",
20+
"prettify:updated": "pipe-git-updated --ext=cjs --ext=css --ext=html --ext=js --ext=json --ext=md --ext=mjs --ext=yaml --ext=yml --base=main -- prettier --write && pipe-git-updated --base=main bin -- prettier --write --parser=babel",
2121
"test": "mocha --config test/mocha/unit.cjs"
2222
},
2323
"license": "MIT",

src/utils/fs/fileExists.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ const fileExists = curry(async (filePath) => {
77
try {
88
const stats = await fse.lstat(filePath);
99
return stats.isFile();
10-
} catch (error) {
10+
} catch {
1111
return false;
1212
}
1313
});

src/utils/fs/fileExistsSync.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ const fileExistsSync = (filePath) => {
66
try {
77
const stats = fse.lstatSync(filePath);
88
return stats.isFile();
9-
} catch (e) {
9+
} catch {
1010
return false;
1111
}
1212
};

0 commit comments

Comments
 (0)