Skip to content

Commit

Permalink
fix: eslint config, build action and imports
Browse files Browse the repository at this point in the history
  • Loading branch information
OM authored and OM committed Dec 20, 2023
1 parent 622e22d commit 1554361
Show file tree
Hide file tree
Showing 18 changed files with 5,812 additions and 2,533 deletions.
36 changes: 36 additions & 0 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
module.exports = {
env: {
node: true,
es2022: true,
browser: true,
},
extends: ["eslint:recommended", "plugin:astro/recommended"],
parserOptions: {
ecmaVersion: "latest",
sourceType: "module",
},
rules: {},
overrides: [
{
files: ["*.astro"],
parser: "astro-eslint-parser",
parserOptions: {
parser: "@typescript-eslint/parser",
extraFileExtensions: [".astro"],
},
rules: {},
},
{
files: ["*.ts"],
parser: "@typescript-eslint/parser",
extends: ["plugin:@typescript-eslint/recommended"],
rules: {
"@typescript-eslint/no-unused-vars": [
"error",
{ argsIgnorePattern: "^_", destructuredArrayIgnorePattern: "^_" },
],
"@typescript-eslint/no-non-null-assertion": "off",
},
},
],
};
33 changes: 0 additions & 33 deletions .eslintrc.js

This file was deleted.

6 changes: 3 additions & 3 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Tests
name: Build

on:
push:
Expand All @@ -14,7 +14,7 @@ jobs:
steps:
- uses: actions/checkout@v4
- name: Use Node.js
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: "18.x"

Expand All @@ -29,4 +29,4 @@ jobs:
run: pnpm install

- name: Run unit tests
run: pnpm run build
run: pnpm run build
6 changes: 4 additions & 2 deletions .github/workflows/cypress.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,10 @@ jobs:
- name: Install dependencies
run: pnpm install

# Install NPM dependencies, cache them correctly
# and run all Cypress tests
- name: Cypress run
uses: cypress-io/github-action@v6
with:
working-directory: packages/cypress
build: npx cypress run
build: pnpm run build
start: pnpm start
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,4 @@ jobs:
run: pnpm install

- name: Run unit tests
run: pnpm run test
run: pnpm run test
31 changes: 16 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,20 +13,21 @@ This is a quick start-up template configured with the following libraries.

All commands are run from the root of the project, from a terminal:

| Command | Action |
| :------------------------ | :----------------------------------------------- |
| `pnpm install` | Installs dependencies |
| `pnpm run dev` | Starts local dev server at `localhost:4321` |
| `pnpm run build` | Build your production site to `./dist/` |
| `pnpm run preview` | Preview your build locally, before deploying |
| `pnpm run astro ...` | Run CLI commands like `astro add`, `astro check` |
| `pnpm run astro -- --help` | Get help using the Astro CLI |
| `pnpm run test` | Run unit tests |
| `pnpm run test:e2e` | Run cypress integration tests
| `pnpm run prettier` | Run prettier with default astro recommended prettier set up|
| `pnpm run lint:eslint` | Run lint|

Feel free to use any package manager you feel more confident with.
| Command | Action |
| :------------------------- | :---------------------------------------------------------- |
| `pnpm install` | Installs dependencies |
| `pnpm run dev` | Starts local dev server at `localhost:4321` |
| `pnpm run build` | Build your production site to `./dist/` |
| `pnpm run preview` | Preview your build locally, before deploying |
| `pnpm run astro ...` | Run CLI commands like `astro add`, `astro check` |
| `pnpm run astro -- --help` | Get help using the Astro CLI |
| `pnpm run test` | Run unit tests |
| `pnpm run test:e2e` | Run cypress integration tests |
| `pnpm run prettier` | Run prettier with default astro recommended prettier set up |
| `pnpm run lint:eslint` | Run lint |

Feel free to use any package manager you feel more confident with.

---
Made with 💚 for the sake of speed 🚀

Made with 💚 for the sake of speed 🚀
2 changes: 1 addition & 1 deletion cypress/e2e/index.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@ it("titles are correct", () => {
const page = cy.visit("http://localhost:4321");

page.get("title").should("have.text", "Astro is awesome!");
page.get("h1").should("have.text", "Hello world from Astro");
page.get("h2").should("have.text", "Hello world from Astro");
});
14 changes: 7 additions & 7 deletions cypress/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"compilerOptions": {
"target": "es5",
"lib": ["es5", "dom"],
"types": ["cypress"]
},
"include": ["**/*.ts"]
}
"compilerOptions": {
"target": "es5",
"lib": ["es5", "dom"],
"types": ["cypress"]
},
"include": ["**/*.ts"]
}
4 changes: 0 additions & 4 deletions jest.config.json

This file was deleted.

2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"name": "astro-typescript-template",
"type": "module",
"version": "0.0.1",
"scripts": {
"dev": "astro dev",
Expand Down Expand Up @@ -36,6 +37,7 @@
"cypress": "^13.6.1",
"eslint": "^8.56.0",
"eslint-plugin-astro": "^0.31.0",
"jsdom": "^23.0.1",
"prettier": "^3.1.1",
"prettier-plugin-astro": "^0.12.2",
"vitest": "^1.1.0"
Expand Down
Loading

0 comments on commit 1554361

Please sign in to comment.