Skip to content

Commit

Permalink
chore: housekeeping (#941)
Browse files Browse the repository at this point in the history
* chore: workspace config

* fix(deps): eslint v9

- drops eslint-config-airbnb

* chore: remove minor lint warnings
  • Loading branch information
hoonoh authored Oct 27, 2024
1 parent 291cc67 commit 936958a
Show file tree
Hide file tree
Showing 11 changed files with 393 additions and 415 deletions.
2 changes: 0 additions & 2 deletions .eslintignore

This file was deleted.

71 changes: 0 additions & 71 deletions .eslintrc.yml

This file was deleted.

62 changes: 22 additions & 40 deletions aws-spot-price.code-workspace
Original file line number Diff line number Diff line change
@@ -1,70 +1,55 @@
{
"folders": [
{
"path": "."
}
"path": ".",
},
],

"settings": {
"typescript.tsdk": ".yarn/sdks/typescript/lib",
"eslint.nodePath": ".yarn/sdks",
"prettier.prettierPath": ".yarn/sdks/prettier/index.js",

// editor
"editor.codeActionsOnSave": {
"source.fixAll.eslint": "explicit"
"editor.defaultFormatter": "esbenp.prettier-vscode",
"[scss]": {
"editor.defaultFormatter": "esbenp.prettier-vscode",
},
"editor.rulers": [100],
"editor.tabSize": 2,
"editor.formatOnSave": true,
"editor.formatOnType": true,
"editor.formatOnSaveMode": "file",
"editor.codeActionsOnSave": {
"source.fixAll.stylelint": "always",
"source.formatDocument": "always",
"source.fixAll.eslint": "always",
},

// eslint
"eslint.validate": ["javascript", "typescript"],
"eslint.run": "onType",

// formatters
"editor.defaultFormatter": "dbaeumer.vscode-eslint",
"[javascript]": {
"editor.defaultFormatter": "dbaeumer.vscode-eslint"
},
"[typescript]": {
"editor.defaultFormatter": "dbaeumer.vscode-eslint"
},
"[json]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[jsonc]": {
"editor.defaultFormatter": "dbaeumer.vscode-eslint"
},
"[yaml]": {
"editor.defaultFormatter": "dbaeumer.vscode-eslint"
},

"files.watcherExclude": {
"**/.git/objects/**": true,
"**/.git/subtree-cache/**": true,
"**/node_modules/**": true,
"**/.hg/store/**": true,
"yarn.lock": true
"yarn.lock": true,
},

"search.exclude": {
"**/node_modules": true,
"**/bower_components": true,
"**/*.code-search": true,
".yarn": true,
"yarn.lock": true
}
"yarn.lock": true,
},
},

"extensions": {
"recommendations": [
"dbaeumer.vscode-eslint",
"esbenp.prettier-vscode",
"KnisterPeter.vscode-commitizen",
"arcanis.vscode-zipfs"
]
"arcanis.vscode-zipfs",
],
},

"launch": {
Expand All @@ -76,11 +61,10 @@
"args": ["${relativeFile}"],
"sourceMaps": true,
"runtimeArgs": ["--nolazy", "-r", "ts-node/register"],
"protocol": "inspector",
"console": "integratedTerminal",
"internalConsoleOptions": "neverOpen",
"runtimeExecutable": "node",
"cwd": "${workspaceRoot}"
"cwd": "${workspaceRoot}",
},
{
"name": "current TS test file",
Expand All @@ -89,11 +73,10 @@
"program": "${workspaceRoot}/node_modules/.bin/jest",
"args": ["--runInBand", "--no-cache", "${relativeFile}"],
"sourceMaps": true,
"protocol": "inspector",
"console": "integratedTerminal",
"internalConsoleOptions": "neverOpen",
"runtimeExecutable": "node",
"cwd": "${workspaceRoot}"
"cwd": "${workspaceRoot}",
},
{
"name": "current TS test file with selected text as test name",
Expand All @@ -102,12 +85,11 @@
"program": "${workspaceRoot}/node_modules/.bin/jest",
"args": ["--runInBand", "--no-cache", "-t", "${selectedText}", "${relativeFile}"],
"sourceMaps": true,
"protocol": "inspector",
"console": "integratedTerminal",
"internalConsoleOptions": "neverOpen",
"runtimeExecutable": "node",
"cwd": "${workspaceRoot}"
}
]
}
"cwd": "${workspaceRoot}",
},
],
},
}
114 changes: 114 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
import unusedImports from 'eslint-plugin-unused-imports';
import typescriptEslint from '@typescript-eslint/eslint-plugin';
import prettier from 'eslint-plugin-prettier';
import simpleImportSort from 'eslint-plugin-simple-import-sort';
import globals from 'globals';
import tsParser from '@typescript-eslint/parser';
import jest from 'eslint-plugin-jest';
import path from 'node:path';
import { fileURLToPath } from 'node:url';
import js from '@eslint/js';
import { FlatCompat } from '@eslint/eslintrc';

const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
const compat = new FlatCompat({
baseDirectory: __dirname,
recommendedConfig: js.configs.recommended,
allConfig: js.configs.all,
});

export default [
{
ignores: ['**/dist', '**/types', 'eslint.config.mjs'],
},
...compat.extends('plugin:@typescript-eslint/recommended', 'prettier'),
{
plugins: {
'unused-imports': unusedImports,
'@typescript-eslint': typescriptEslint,
prettier,
'simple-import-sort': simpleImportSort,
},

languageOptions: {
globals: {
...globals.node,
},

parser: tsParser,
ecmaVersion: 2018,
sourceType: 'module',

parserOptions: {
project: './tsconfig.eslint.json',
},
},

settings: {
'import/parsers': {
'@typescript-eslint/parser': ['.ts'],
},

'import/resolver': {
node: {
extensions: ['.ts'],
},
},
},

rules: {
'import/extensions': 0,
'import/no-extraneous-dependencies': 0,
'import/prefer-default-export': 0,
'no-console': 0,
'no-param-reassign': 0,
'prettier/prettier': 'error',
'simple-import-sort/imports': 2,
'simple-import-sort/exports': 2,
'@typescript-eslint/no-unused-vars': 'off',
'@typescript-eslint/no-explicit-any': 'off',
'unused-imports/no-unused-imports': 'error',

'unused-imports/no-unused-vars': [
'warn',
{
vars: 'all',
varsIgnorePattern: '^_',
args: 'after-used',
argsIgnorePattern: '^_',
},
],
},
},
{
files: ['test/*.js'],

rules: {
'@typescript-eslint/explicit-function-return-type': 0,
'@typescript-eslint/no-var-requires': 0,
},
},
{
files: ['**/*.spec.ts', 'test/jest.setup.js', 'test/**/*.ts'],

plugins: {
jest,
},

languageOptions: {
globals: {
...jest.environments.globals.globals,
},
},
},
{
files: ['**/*.spec.ts', 'util/**/*.ts', 'test/**/*.ts'],

rules: {
'import/no-extraneous-dependencies': 0,
'@typescript-eslint/ban-ts-ignore': 0,
'no-underscore-dangle': 0,
},
},
];
13 changes: 7 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@
"@aws-sdk/client-ssm": "3.679.0",
"@aws-sdk/client-sts": "3.679.0",
"@commitlint/cli": "19.5.0",
"@eslint/eslintrc": "3.1.0",
"@eslint/js": "9.13.0",
"@semantic-release/changelog": "6.0.3",
"@semantic-release/commit-analyzer": "13.0.0",
"@semantic-release/git": "10.0.1",
Expand All @@ -69,24 +71,23 @@
"@types/prettier": "3.0.0",
"@types/prompts": "2.4.9",
"@types/yargs": "17.0.33",
"@typescript-eslint/eslint-plugin": "7.18.0",
"@typescript-eslint/parser": "7.18.0",
"@typescript-eslint/eslint-plugin": "8.11.0",
"@typescript-eslint/parser": "8.11.0",
"aws-sdk-client-mock": "4.1.0",
"commitizen": "4.3.1",
"conventional-changelog-cli": "5.0.0",
"cz-conventional-changelog": "3.3.0",
"dts-bundle-generator": "9.4.0",
"esbuild": "0.24.0",
"eslint": "8.57.1",
"eslint-config-airbnb-base": "15.0.0",
"eslint-config-airbnb-typescript": "18.0.0",
"eslint": "9.13.0",
"eslint-config-prettier": "9.1.0",
"eslint-import-resolver-typescript": "3.6.3",
"eslint-plugin-import": "2.31.0",
"eslint-plugin-jest": "28.8.3",
"eslint-plugin-prettier": "5.2.1",
"eslint-plugin-simple-import-sort": "12.1.1",
"eslint-plugin-unused-imports": "3.2.0",
"eslint-plugin-unused-imports": "4.1.4",
"globals": "15.11.0",
"husky": "9.1.6",
"jest": "29.7.0",
"jest-junit": "16.0.0",
Expand Down
6 changes: 3 additions & 3 deletions src/cli.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ describe('cli', () => {
let caughtError = false;
try {
await main(['--secretAccessKey', 'rand']);
} catch (error) {
} catch {
caughtError = true;
}
expect(caughtError).toBeTruthy();
Expand All @@ -121,7 +121,7 @@ describe('cli', () => {
let caughtError = false;
try {
await main(['--accessKeyId', 'rand']);
} catch (error) {
} catch {
caughtError = true;
}
expect(caughtError).toBeTruthy();
Expand Down Expand Up @@ -191,7 +191,7 @@ describe('cli', () => {
let caughtError = false;
try {
await main(['--accessKeyId', 'rand', '--secretAccessKey', 'rand']);
} catch (error) {
} catch {
caughtError = true;
}
expect(caughtError).toBeTruthy();
Expand Down
2 changes: 1 addition & 1 deletion src/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -424,7 +424,7 @@ if (
(async (): Promise<void> => {
try {
await main();
} catch (error) {
} catch {
//
}
})();
Expand Down
Loading

0 comments on commit 936958a

Please sign in to comment.