Skip to content

Commit

Permalink
Modernize ESlint config
Browse files Browse the repository at this point in the history
  • Loading branch information
akx committed Feb 11, 2022
1 parent 648798e commit fa188b6
Show file tree
Hide file tree
Showing 7 changed files with 356 additions and 213 deletions.
44 changes: 0 additions & 44 deletions .eslintrc

This file was deleted.

37 changes: 37 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
module.exports = {
extends: [
"plugin:@typescript-eslint/recommended",
"plugin:react-hooks/recommended",
"plugin:react/recommended",
"plugin:jsx-a11y/recommended",
"plugin:@next/next/recommended",
"prettier",
],
settings: {
react: {
version: "detect",
},
},
env: {
browser: true,
node: true,
},
parser: "@typescript-eslint/parser",
parserOptions: {
ecmaVersion: 2020,
sourceType: "module",
ecmaFeatures: {
jsx: true,
},
},
rules: {
"@typescript-eslint/ban-types": "warn",
"no-use-before-define": 0,
"padded-blocks": 0,
"react/jsx-no-target-blank": 0,
"react/jsx-uses-react": 2,
"react/jsx-uses-vars": 2,
"react/prop-types": 0,
"react/react-in-jsx-scope": 2,
},
};
2 changes: 2 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
.next
out
1 change: 1 addition & 0 deletions components/ChannelReferenceRenderer.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* eslint-disable @typescript-eslint/ban-types */
import React from "react";

function renderStringWithChannelRefs(value: string) {
Expand Down
3 changes: 1 addition & 2 deletions components/Feed.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@ import ReactTimeAgo from "react-time-ago";
import JavascriptTimeAgo from "javascript-time-ago";
import timeagoFi from "javascript-time-ago/locale/fi";

// TODO: Add type definitions for javascript-time-ago
(JavascriptTimeAgo as any).locale(timeagoFi);
JavascriptTimeAgo.addLocale(timeagoFi);

export default class Feed extends React.Component {
state = {
Expand Down
9 changes: 6 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
"build": "next build && next export",
"dev": "SERVER=http://localhost:9000/ NODE_ENV=development next",
"prod": "NODE_ENV=production next build && next export",
"lint": "eslint --ext .jsx --ext .js .",
"prettify": "prettier --write components pages styles"
"lint": "eslint --ext .tsx --ext .ts .",
"prettify": "prettier --write ."
},
"dependencies": {
"@zeit/next-css": "^1.0.1",
Expand All @@ -35,13 +35,16 @@
"utility-types": "^3.10.0"
},
"devDependencies": {
"@next/eslint-plugin-next": "^12.0.10",
"@types/node": "17.0.17",
"@types/react": "17.0.39",
"babel-eslint": "^10.0.3",
"@typescript-eslint/eslint-plugin": "^5.11.0",
"@typescript-eslint/parser": "^5.11.0",
"eslint": "^8.8.0",
"eslint-config-prettier": "^8.3.0",
"eslint-plugin-jsx-a11y": "^6.5.1",
"eslint-plugin-react": "^7.28.0",
"eslint-plugin-react-hooks": "^4.3.0",
"prettier": "^2.5.1",
"typescript": "4.5.5"
},
Expand Down
Loading

0 comments on commit fa188b6

Please sign in to comment.