Reinstate linting, fix kvetches

This commit is contained in:
Aarni Koskela
2019-09-23 16:25:42 +03:00
parent ed0826a53a
commit 186f8744ff
12 changed files with 32 additions and 27 deletions

View File

@@ -1,8 +1,22 @@
{
"extends": "airbnb",
"ecmaFeatures": {
"jsx": true,
"modules": true
"extends": [
"eslint:recommended",
"plugin:react/recommended",
"prettier"
],
"plugins": [
"react"
],
"parserOptions": {
"ecmaFeatures": {
"jsx": true,
"modules": true
}
},
"settings": {
"react": {
"version": "detect"
}
},
"env": {
"browser": true,
@@ -10,13 +24,11 @@
},
"parser": "babel-eslint",
"rules": {
"quotes": [2, "single"],
"react/jsx-uses-react": 2,
"react/jsx-uses-vars": 2,
"react/react-in-jsx-scope": 2,
"react/jsx-no-target-blank": 1,
"comma-dangle": [2, "never"],
"space-after-keywords": [2, "never"],
"react/jsx-quotes": [2, "single"],
"react/prop-types": 0,
"no-use-before-define": 0,
"padded-blocks": 0,
@@ -24,10 +36,7 @@
"min": 3,
"max": 30,
"properties": "never",
"exceptions": ["x", "y", "vx", "vy", "id", "i", "e", "fn"]
"exceptions": ["x", "y", "vx", "vy", "id", "i", "e", "fn", "_"]
}]
},
"plugins": [
"react"
]
}
}

View File

@@ -1,5 +1,3 @@
"use strict";
import React from "react";
export default function EmailComponent() {

View File

@@ -1,5 +1,3 @@
"use strict";
import React from "react";
function clamp(min, max, value) {

View File

@@ -1,5 +1,3 @@
"use strict";
import React from "react";
import request from "axios";
import _ from "lodash";

View File

@@ -1,3 +1,4 @@
import React from "react";
import EmailComponent from "./EmailComponent";
export function Footer() {

View File

@@ -1,5 +1,3 @@
"use strict";
import request from "axios";
import React from "react";
import classSet from "classnames";

View File

@@ -1,5 +1,3 @@
"use strict";
import React from "react";
import request from "axios";
import _ from "lodash";

View File

@@ -1,5 +1,3 @@
"use strict";
import _ from "lodash";
import githubEvent from "parse-github-event";
import twitterText from "twitter-text";

View File

@@ -18,9 +18,10 @@ var fieldNameTranslations = {
postcode: { fi: "Postinumero" }
};
const mailValidateRe = /^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
function validateEmail(email) {
var re = /^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
return re.test(email);
return mailValidateRe.test(email);
}
const fieldNames = ["name", "email", "handle", "address", "postcode", "city"];

View File

@@ -10,7 +10,7 @@
"build": "rm -rf public && gulp build",
"dev": "SERVER=http://localhost:9000/ ENV=development npm start",
"prod": "ENV=production npm start",
"lint": "eslint src"
"lint": "eslint --ext .jsx --ext .js ."
},
"dependencies": {
"@zeit/next-css": "^1.0.1",
@@ -34,6 +34,10 @@
"twitter-text": "^1.11.0"
},
"devDependencies": {
"babel-eslint": "^10.0.3",
"eslint": "^6.4.0",
"eslint-config-prettier": "^6.3.0",
"eslint-plugin-react": "^7.14.3",
"prettier": "^1.18.2"
}
}

View File

@@ -1,3 +1,4 @@
import React from "react";
import Document, { Html, Head, Main, NextScript } from "next/document";
import { Footer } from "../components/Footer";
import Fader from '../components/Fader';

View File

@@ -1,3 +1,4 @@
import React from "react";
import "../styles/style.styl";
import "../styles/icons.less";
import Head from "next/head";