Skip to content

Commit

Permalink
Use ESLint on .astro and .ts files (withastro#710)
Browse files Browse the repository at this point in the history
Co-authored-by: Chris Swithinbank <[email protected]>
  • Loading branch information
ota-meshi and delucis authored Jun 3, 2022
1 parent 63b8838 commit 00a0522
Show file tree
Hide file tree
Showing 13 changed files with 698 additions and 383 deletions.
5 changes: 5 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
dist
node_modules
.github
.changeset
/src/pages/lighthouse
33 changes: 33 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
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',
},
},
],
};
9 changes: 8 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
"lint:linkcheck": "astro build && tsm --require=./scripts/lib/filter-warnings.cjs ./scripts/lint-linkcheck.ts",
"lint:linkcheck:nobuild": "tsm --require=./scripts/lib/filter-warnings.cjs ./scripts/lint-linkcheck.ts",
"lint:slugcheck": "node ./scripts/lint-slugcheck.mjs",
"lint:eslint": "eslint . --ext .js,.ts,.astro",
"github:translation-status": "node ./scripts/github-translation-status.mjs"
},
"devDependencies": {
Expand All @@ -25,9 +26,14 @@
"@astrojs/sitemap": "^0.1.0",
"@babel/core": "^7.17.9",
"@types/react": "^17.0.43",
"@typescript-eslint/eslint-plugin": "^5.27.0",
"@typescript-eslint/parser": "^5.27.0",
"astro": "^1.0.0-beta.17",
"astro-eslint-parser": "^0.2.2",
"bcp-47-normalize": "^2.1.0",
"dedent-js": "^1.0.1",
"eslint": "^8.16.0",
"eslint-plugin-astro": "^0.8.1",
"fast-glob": "^3.2.11",
"htmlparser2": "^7.2.0",
"kleur": "^4.1.4",
Expand All @@ -38,7 +44,8 @@
"react": "^17.0.2",
"react-dom": "^17.0.2",
"simple-git": "^3.7.1",
"tsm": "^2.2.1"
"tsm": "^2.2.1",
"typescript": "^4.7.2"
},
"dependencies": {
"@astropub/icons": "^0.2.0",
Expand Down
Loading

0 comments on commit 00a0522

Please sign in to comment.