Chore: Update eslint configuration (#224)
- Update missing dev dependencies - Fix root .eslintrc.json and client and server versions - Add lint.yaml workflow - Remove babel settings - Clean up and fix eslint and ts errors
This commit is contained in:
@@ -1,8 +0,0 @@
|
||||
{
|
||||
"presets": ["@babel/react"],
|
||||
"plugins": [
|
||||
"@babel/plugin-proposal-object-rest-spread",
|
||||
"@babel/plugin-proposal-class-properties",
|
||||
"@babel/plugin-proposal-optional-chaining"
|
||||
]
|
||||
}
|
||||
+12
-21
@@ -1,35 +1,24 @@
|
||||
{
|
||||
"root": true,
|
||||
"parser": "@babel/eslint-parser",
|
||||
"extends": [
|
||||
"airbnb-base",
|
||||
"plugin:prettier/recommended",
|
||||
"plugin:react/recommended"
|
||||
"eslint:recommended",
|
||||
"plugin:@typescript-eslint/recommended",
|
||||
"plugin:react-hooks/recommended"
|
||||
],
|
||||
"plugins": ["babel", "react", "prettier"],
|
||||
"env": {
|
||||
"browser": true,
|
||||
"es6": true
|
||||
},
|
||||
"globals": {
|
||||
"google": false,
|
||||
"alert": false,
|
||||
"css": true
|
||||
},
|
||||
"parserOptions": {
|
||||
"ecmaVersion": 9,
|
||||
"sourceType": "module",
|
||||
"ecmaFeatures": {
|
||||
"jsx": true
|
||||
}
|
||||
},
|
||||
"plugins": ["react-refresh", "prettier"],
|
||||
"rules": {
|
||||
"prettier/prettier": "error",
|
||||
"react/prop-types": "warn",
|
||||
"camelcase": "warn",
|
||||
"import/prefer-default-export": "warn",
|
||||
"import/no-extraneous-dependencies": "warn",
|
||||
"prefer-object-spread": "warn",
|
||||
"spaced-comment": "off",
|
||||
"react-refresh/only-export-components": [
|
||||
"warn",
|
||||
{ "allowConstantExport": true }
|
||||
],
|
||||
"import/extensions": [
|
||||
"error",
|
||||
"ignorePackages",
|
||||
@@ -50,5 +39,7 @@
|
||||
"extensions": [".js", ".jsx", ".ts", ".tsx"]
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"env": { "browser": true, "es2020": true },
|
||||
"parser": "@typescript-eslint/parser"
|
||||
}
|
||||
|
||||
@@ -23,9 +23,7 @@ const FormInput = ({ submitNewSheet }: FormInputProps) => {
|
||||
};
|
||||
|
||||
return (
|
||||
<form
|
||||
onSubmit={handleSubmit}
|
||||
>
|
||||
<form onSubmit={handleSubmit}>
|
||||
<Grid container spacing={2}>
|
||||
<Grid item xs={10}>
|
||||
<TextField
|
||||
|
||||
@@ -4,7 +4,6 @@ import { Button, Typography } from '@mui/material';
|
||||
import FormInput from './FormInput';
|
||||
import SheetTable from './SheetTable';
|
||||
|
||||
|
||||
// This is a wrapper for google.script.run that lets us use promises.
|
||||
import { serverFunctions } from '../../utils/serverFunctions';
|
||||
|
||||
@@ -40,29 +39,40 @@ const SheetEditor = () => {
|
||||
</Typography>
|
||||
|
||||
<Typography variant="body1" gutterBottom sx={{ marginBottom: '30px' }}>
|
||||
This is a sample app that uses the <code>mui</code> library
|
||||
to help us build a simple React app. Enter a name for a new sheet, hit
|
||||
enter and the new sheet will be created. Click the red button next to the sheet name to
|
||||
delete it.
|
||||
This is a sample app that uses the <code>mui</code> library to help us
|
||||
build a simple React app. Enter a name for a new sheet, hit enter and
|
||||
the new sheet will be created. Click the red button next to the sheet
|
||||
name to delete it.
|
||||
</Typography>
|
||||
<FormInput submitNewSheet={submitNewSheet} />
|
||||
|
||||
{names.length > 0 &&
|
||||
<SheetTable rows={names.map((name) => {
|
||||
return {
|
||||
sheetName: name.name,
|
||||
goToButton: <Button
|
||||
variant="outlined"
|
||||
disabled={name?.isActive}
|
||||
onClick={() => setActiveSheet(name.name)}
|
||||
>Go To Sheet</Button>,
|
||||
deleteButton: <Button
|
||||
variant="contained"
|
||||
color="error"
|
||||
onClick={() => deleteSheet(name.index)}
|
||||
>Delete</Button>
|
||||
}
|
||||
})} />}
|
||||
{names.length > 0 && (
|
||||
<SheetTable
|
||||
rows={names.map((name) => {
|
||||
return {
|
||||
sheetName: name.name,
|
||||
goToButton: (
|
||||
<Button
|
||||
variant="outlined"
|
||||
disabled={name?.isActive}
|
||||
onClick={() => setActiveSheet(name.name)}
|
||||
>
|
||||
Go To Sheet
|
||||
</Button>
|
||||
),
|
||||
deleteButton: (
|
||||
<Button
|
||||
variant="contained"
|
||||
color="error"
|
||||
onClick={() => deleteSheet(name.index)}
|
||||
>
|
||||
Delete
|
||||
</Button>
|
||||
),
|
||||
};
|
||||
})}
|
||||
/>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
@@ -1,5 +1,12 @@
|
||||
import * as React from 'react';
|
||||
import { Table, TableBody, TableCell, TableContainer, TableHead, TableRow } from '@mui/material';
|
||||
import {
|
||||
Table,
|
||||
TableBody,
|
||||
TableCell,
|
||||
TableContainer,
|
||||
TableHead,
|
||||
TableRow,
|
||||
} from '@mui/material';
|
||||
|
||||
type sheetRow = {
|
||||
sheetName: string;
|
||||
|
||||
@@ -1,7 +1,11 @@
|
||||
import { useState, ChangeEvent, FormEvent } from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
|
||||
const FormInput = ({ submitNewSheet }: { submitNewSheet: Function }) => {
|
||||
const FormInput = ({
|
||||
submitNewSheet,
|
||||
}: {
|
||||
submitNewSheet: (arg: string) => void;
|
||||
}) => {
|
||||
const [inputValue, setInputValue] = useState('');
|
||||
|
||||
const handleChange = (event: ChangeEvent<HTMLInputElement>) =>
|
||||
|
||||
@@ -1,18 +0,0 @@
|
||||
{
|
||||
"presets": [
|
||||
[
|
||||
"@babel/env",
|
||||
{
|
||||
"modules": false
|
||||
}
|
||||
]
|
||||
],
|
||||
"plugins": [
|
||||
"transform-es3-property-literals",
|
||||
"transform-es3-member-expression-literals",
|
||||
"@babel/plugin-proposal-class-properties",
|
||||
"@babel/plugin-proposal-object-rest-spread",
|
||||
"@babel/plugin-transform-object-assign",
|
||||
"@babel/plugin-proposal-optional-chaining"
|
||||
]
|
||||
}
|
||||
@@ -1,7 +1,12 @@
|
||||
{
|
||||
"root": true,
|
||||
"parser": "@babel/eslint-parser",
|
||||
"extends": ["airbnb-base", "plugin:prettier/recommended"],
|
||||
"parser": "@typescript-eslint/parser",
|
||||
"extends": [
|
||||
"airbnb-base",
|
||||
"plugin:prettier/recommended",
|
||||
"eslint:recommended",
|
||||
"plugin:@typescript-eslint/recommended"
|
||||
],
|
||||
"plugins": ["prettier", "googleappsscript"],
|
||||
"env": {
|
||||
"googleappsscript/googleappsscript": true
|
||||
@@ -11,7 +16,15 @@
|
||||
"camelcase": "warn",
|
||||
"import/prefer-default-export": "warn",
|
||||
"import/no-extraneous-dependencies": "warn",
|
||||
"prefer-object-spread": "warn"
|
||||
"prefer-object-spread": "warn",
|
||||
"import/extensions": [
|
||||
"error",
|
||||
"ignorePackages",
|
||||
{
|
||||
"js": "never",
|
||||
"ts": "never"
|
||||
}
|
||||
]
|
||||
},
|
||||
"settings": {
|
||||
"import/resolver": {
|
||||
|
||||
Reference in New Issue
Block a user