Skip to content

Commit

Permalink
Add husky and lint-staged to run prettier before commit. Adds a11y pl…
Browse files Browse the repository at this point in the history
…ugin for linter (#30)

Also adds a11y plugin for a static accessibility check with the recommended rules turned on.
  • Loading branch information
neko-mamushi authored May 23, 2022
1 parent d35666d commit f3a72a6
Show file tree
Hide file tree
Showing 8 changed files with 715 additions and 4 deletions.
4 changes: 3 additions & 1 deletion .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@
"extends": [
"next/core-web-vitals",
"plugin:@typescript-eslint/recommended",
"prettier"
"prettier",
"plugin:jsx-a11y/recommended"
],
"plugins": ["jsx-a11y"],
"rules": {
"no-warning-comments": [
"warn",
Expand Down
1 change: 1 addition & 0 deletions .husky/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
_
4 changes: 4 additions & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

npx lint-staged
10 changes: 10 additions & 0 deletions .lintstagedrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
const path = require('path')

const buildEslintCommand = (filenames) =>
`next lint --fix --file ${filenames
.map((f) => path.relative(process.cwd(), f))
.join(' --file ')}`

module.exports = {
'*.{js,jsx,ts,tsx}': [buildEslintCommand],
}
2 changes: 1 addition & 1 deletion components/Nav/Nav.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ export default function Nav({

{showBackButton && (
<Link href={`/politicians`} passHref>
<a aria-label="Go back">
<a href={`/politicians`} aria-label="Go back">
<FaChevronLeft
className={styles.backButton}
color="var(--white)"
Expand Down
Loading

1 comment on commit f3a72a6

@vercel
Copy link

@vercel vercel bot commented on f3a72a6 May 23, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.