Explorar el Código

add eslint and build scripts

mightyplow hace 5 años
padre
commit
28db2a2ee6
Se han modificado 6 ficheros con 1154 adiciones y 7 borrados
  1. 28 0
      .eslintrc.js
  2. 2 0
      .gitignore
  3. 1096 6
      package-lock.json
  4. 14 1
      package.json
  5. 13 0
      src/index.html
  6. 1 0
      src/index.tsx

+ 28 - 0
.eslintrc.js

@@ -0,0 +1,28 @@
+module.exports = {
+  env: {
+    browser: true,
+    es6: true,
+  },
+  extends: [
+    'standard',
+  ],
+  globals: {
+    Atomics: 'readonly',
+    SharedArrayBuffer: 'readonly',
+  },
+  parser: '@typescript-eslint/parser',
+  parserOptions: {
+    ecmaFeatures: {
+      jsx: true,
+    },
+    ecmaVersion: 2018,
+    sourceType: 'module',
+  },
+  plugins: [
+    'react',
+    '@typescript-eslint',
+  ],
+  rules: {
+    semi: ['error', 'always'],
+  },
+};

+ 2 - 0
.gitignore

@@ -1,2 +1,4 @@
+.cache/
 .idea/
+dist/
 node_modules/

La diferencia del archivo ha sido suprimido porque es demasiado grande
+ 1096 - 6
package-lock.json


+ 14 - 1
package.json

@@ -4,6 +4,8 @@
   "description": "A simple web app to track calories.",
   "main": "index.js",
   "scripts": {
+    "build": "parcel build -d dist --public-url / ./src/index.html",
+    "dev": "parcel serve -d dist --public-url / ./src/index.html",
     "test": "echo \"Error: no test specified\" && exit 1"
   },
   "repository": {
@@ -19,8 +21,19 @@
   ],
   "author": "mightyplow@gmail.com",
   "license": "UNLICENSED",
-  "dependencies": {},
+  "dependencies": {
+    "typescript": "^3.7.2"
+  },
   "devDependencies": {
+    "@typescript-eslint/eslint-plugin": "^2.7.0",
+    "@typescript-eslint/parser": "^2.7.0",
+    "eslint": "^6.6.0",
+    "eslint-config-standard": "^14.1.0",
+    "eslint-plugin-import": "^2.18.2",
+    "eslint-plugin-node": "^10.0.0",
+    "eslint-plugin-promise": "^4.2.1",
+    "eslint-plugin-react": "^7.16.0",
+    "eslint-plugin-standard": "^4.0.1",
     "parcel-bundler": "^1.12.4",
     "react": "^16.11.0",
     "react-dom": "^16.11.0"

+ 13 - 0
src/index.html

@@ -0,0 +1,13 @@
+<!doctype html>
+<html lang="en">
+    <head>
+        <meta charset="UTF-8">
+        <meta name="viewport"
+              content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
+        <title>Simple calorie tracker</title>
+    </head>
+    <body>
+        <div id="appContainer"></div>
+        <script src="index.tsx"></script>
+    </body>
+</html>

+ 1 - 0
src/index.tsx

@@ -0,0 +1 @@
+console.log('foo');