Skip to content

Commit

Permalink
Optimization/eslint migration (#13)
Browse files Browse the repository at this point in the history
* upgrade eslint

* upgrade eslint in example
  • Loading branch information
tiavina-mika authored Oct 12, 2024
1 parent 844a66e commit 1cb2829
Show file tree
Hide file tree
Showing 29 changed files with 2,951 additions and 2,744 deletions.
8 changes: 0 additions & 8 deletions .eslintignore

This file was deleted.

77 changes: 0 additions & 77 deletions .eslintrc.cjs

This file was deleted.

36 changes: 18 additions & 18 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,34 +22,34 @@ env:
APP_NAME: check-password-complexity

jobs:
# lint:
# name: Lint
# runs-on: ubuntu-latest
lint:
name: Lint
runs-on: ubuntu-latest

# steps:
# - name: Checkout
# uses: actions/checkout@v4
steps:
- name: Checkout
uses: actions/checkout@v4

# # need this for using yarn v4
# - name: Enable Corepack
# run: corepack enable
# need this for using yarn v4
- name: Enable Corepack
run: corepack enable

# - name: Setup Node.js
# uses: actions/setup-node@v4
# with:
# node-version: '20'
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'

# - name: Install dependencies
# run: yarn
- name: Install dependencies
run: yarn

# - name: Lint
# run: yarn lint
- name: Lint
run: yarn lint

# see: https://qa-nora.medium.com/unit-testing-with-jest-and-integration-with-github-actions-bc241b31d257
test:
name: Test
# need the previous job to be completed
# needs: lint
needs: lint
runs-on: ubuntu-latest

steps:
Expand Down
2 changes: 0 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@ dist-ssr
*.local

# Editor directories and files
.vscode/*
!.vscode/extensions.json
.idea
.DS_Store
*.suo
Expand Down
1 change: 1 addition & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
yarn lint-staged
3 changes: 3 additions & 0 deletions .lintstagedrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"*.{ts,tsx}": "eslint --fix"
}
8 changes: 0 additions & 8 deletions .vscode/extensions.json

This file was deleted.

59 changes: 59 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
{
"// editor": "-------------------------------------",
"editor.codeActionsOnSave": {
"source.fixAll.eslint": "explicit",
"source.organizeImports": "never"
},
"editor.defaultFormatter": "dbaeumer.vscode-eslint",
"editor.formatOnSave": true,
"editor.tabSize": 2,
"eslint.format.enable": true,
"[javascript]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[javascriptreact]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[typescript]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[typescriptreact]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[markdown]": {
"editor.defaultFormatter": "DavidAnson.vscode-markdownlint"
},
"// files": "-------------------------------------",
"files.trimTrailingWhitespace": true,
"files.insertFinalNewline": true,
"files.associations": {
"*.ignore": "plaintext",
"*.txt": "plaintext",
"*.tsx": "typescriptreact", // Associe .tsx à TypeScript pour React
"*.ts": "typescript"
},
"files.exclude": {
"**/*.js": {
"when": "$(basename).ts"
} // Cache les fichiers .js générés si vous utilisez TypeScript
},
"// typescript": "-------------------------------------",
"typescript.tsdk": "./node_modules/typescript/lib",
"typescript.enablePromptUseWorkspaceTsdk": true,
"typescript.validate.enable": true,
"// eslint": "-------------------------------------",
"eslint.validate": [
"javascript",
"javascriptreact",
"typescript",
"typescriptreact",
"html",
"markdown",
"json",
"jsonc",
"yaml"
],
"prettier.enable": true,
"typescript.tsserver.allowLocalPluginLoads": true,
"typescript.tsserver.pluginPaths": ["./"]
}
Binary file modified .yarn/install-state.gz
Binary file not shown.
9 changes: 6 additions & 3 deletions __tests__/index.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,17 +23,20 @@ describe('check default labels', () => {
// ------------ custom options ------------ //
describe('check override labels', () => {
test('custom label', () => {
const option = getPasswordStrengthResult('tooWeak', { tooWeak: { label: 'Too weak 2' } });
const option = getPasswordStrengthResult('tooWeak', { tooWeak: { label: 'Too weak 2' } });

expect(option.label).toBe('Too weak 2');
});

test('custom color', () => {
const option = getPasswordStrengthResult('medium', { medium: { color: 'red' } });
const option = getPasswordStrengthResult('medium', { medium: { color: 'red' } });

expect(option.color).toBe('red');
});

test('custom color and label', () => {
const option = getPasswordStrengthResult('strong', { strong: { color: 'red', label: 'Strong 2' } });
const option = getPasswordStrengthResult('strong', { strong: { color: 'red', label: 'Strong 2' } });

expect(option.label).toBe('Strong 2');
expect(option.color).toBe('red');
});
Expand Down
6 changes: 3 additions & 3 deletions dts-bundle-generator.config.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
const config = {
entries: [
{
filePath: "./src/index.ts",
outFile: "./dist/index.d.ts",
filePath: './src/index.ts',
outFile: './dist/index.d.ts',
noCheck: false,
},
],
};

module.exports = config;
export default config;
Loading

0 comments on commit 1cb2829

Please sign in to comment.