diff --git a/.github/workflows/format.yml b/.github/workflows/format.yml index 74e3862..8437d2a 100644 --- a/.github/workflows/format.yml +++ b/.github/workflows/format.yml @@ -1,6 +1,9 @@ name: Format on: + push: + branches: + - main pull_request: branches: - main @@ -16,11 +19,11 @@ jobs: - name: Set up Node.js uses: actions/setup-node@v3 with: - node-version: '16' # Use the Node.js version your project requires + node-version: '20' - name: Install dependencies run: npm install - name: Run Prettier to check formatting run: npm run prettier -- --check - continue-on-error: false # Fail the workflow if formatting issues are found + continue-on-error: false diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index f144430..79ce8c2 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -1,12 +1,15 @@ -name: Lint and Format +name: Lint on: + push: + branches: + - main pull_request: branches: - main jobs: - lint-and-format: + lint: runs-on: ubuntu-latest steps: @@ -16,13 +19,11 @@ jobs: - name: Set up Node.js uses: actions/setup-node@v3 with: - node-version: '16' # or whichever version your project requires + node-version: '20' - name: Install dependencies run: npm install - - name: Run Prettier to check formatting - run: npm run format -- --check - - name: Run ESLint to check for linting issues run: npm run lint + continue-on-error: false diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index f11e667..0ff6873 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -33,6 +33,16 @@ npm run lint This command will execute ESLint on your project files and report any errors or warnings. +### Running the Formatter + +To format your code, run the following command: + +```bash +npm run format +``` + +This command will execute Prettier on your project files and apply consistent formatting according to the rules defined in your configuration. + ## Maintainers This project is actively maintained by: diff --git a/README.md b/README.md index 0f5c1ef..adef21e 100644 --- a/README.md +++ b/README.md @@ -43,6 +43,16 @@ npm run lint This command will execute ESLint on your project files and report any errors or warnings. +### Running the Formatter + +To format your code, run the following command: + +```bash +npm run format +``` + +This command will execute Prettier on your project files and apply consistent formatting according to the rules defined in your configuration. + ## Contributing to Hacktoberfest 2024 🎉 ![hecktoberfest](https://github.com/user-attachments/assets/9352e904-6b2d-495e-8140-1437e385ffdb) diff --git a/package.json b/package.json index a9b006b..19b8339 100644 --- a/package.json +++ b/package.json @@ -6,6 +6,7 @@ "scripts": { "test": "echo \"Error: no test specified\" && exit 1", "format": "prettier --write .", + "prettier": "prettier --check .", "lint": "eslint ." }, "keywords": [], diff --git a/script.js b/script.js index 16b4c74..6453222 100644 --- a/script.js +++ b/script.js @@ -41,13 +41,14 @@ function addTodo() { updateTodoList(); } +// eslint-disable-next-line no-unused-vars function deleteTodo(index) { // Remove the specific todo from the list todoList.splice(index, 1); localStorage.setItem('todoList', JSON.stringify(todoList)); updateTodoList(); } - +// eslint-disable-next-line no-unused-vars function editTodo(index) { let inputNameElement = document.querySelector('.js-name-input'); let inputDateElement = document.querySelector('.js-date-input');