Skip to content

Commit

Permalink
update agreed/ui to pass lint
Browse files Browse the repository at this point in the history
  • Loading branch information
yosuke-furukawa committed Mar 14, 2024
1 parent 345ee8a commit 897618f
Show file tree
Hide file tree
Showing 9 changed files with 178 additions and 5,423 deletions.
6 changes: 2 additions & 4 deletions .github/workflows/nodejs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,5 @@ jobs:
with:
node-version: ${{ matrix.node-version }}
- run: npm ci
- run: npm i typescript -g
- run: npm run allinstall
- run: npm run lint
- run: npm test
- run: npm run lint --workspaces --if-present
- run: npm test --workspaces --if-present
5,536 changes: 143 additions & 5,393 deletions package-lock.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion packages/typed/src/__tests__/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -151,4 +151,4 @@ test("register ts agrees with get and query (when enable-prefer-query option is
done(e);
}
});
});
});
5 changes: 5 additions & 0 deletions packages/ui/.babelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"presets": [
"@babel/preset-react"
]
}
8 changes: 6 additions & 2 deletions packages/ui/.eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,13 @@
"node": true,
"jest": true
},
"parser": "babel-eslint",
"parser": "@babel/eslint-parser",
"parserOptions": {
"ecmaVersion": 6,
"ecmaVersion": 2020,
"ecmaFeatures": {
"jsx": true
},
"requireConfigFile": false,
"sourceType": "module"
},
"settings": {
Expand Down
2 changes: 1 addition & 1 deletion packages/ui/build/index.html
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<!doctype html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1,shrink-to-fit=no"><meta name="theme-color" content="#000000"><link rel="manifest" href="./manifest.json"><link rel="shortcut icon" href="./favicon.png"><title>Agreed UI</title><link href="./static/css/main.e92ec541.chunk.css" rel="stylesheet"></head><body><noscript>You need to enable JavaScript to run this app.</noscript><div id="root"></div><script>window.TITLE='"<%= title %>"',window.AGREES="<%= agrees %>"</script><script>!function(a){function e(e){for(var r,t,n=e[0],o=e[1],u=e[2],i=0,l=[];i<n.length;i++)t=n[i],Object.prototype.hasOwnProperty.call(p,t)&&p[t]&&l.push(p[t][0]),p[t]=0;for(r in o)Object.prototype.hasOwnProperty.call(o,r)&&(a[r]=o[r]);for(s&&s(e);l.length;)l.shift()();return c.push.apply(c,u||[]),f()}function f(){for(var e,r=0;r<c.length;r++){for(var t=c[r],n=!0,o=1;o<t.length;o++){var u=t[o];0!==p[u]&&(n=!1)}n&&(c.splice(r--,1),e=i(i.s=t[0]))}return e}var t={},p={1:0},c=[];function i(e){if(t[e])return t[e].exports;var r=t[e]={i:e,l:!1,exports:{}};return a[e].call(r.exports,r,r.exports,i),r.l=!0,r.exports}i.m=a,i.c=t,i.d=function(e,r,t){i.o(e,r)||Object.defineProperty(e,r,{enumerable:!0,get:t})},i.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},i.t=function(r,e){if(1&e&&(r=i(r)),8&e)return r;if(4&e&&"object"==typeof r&&r&&r.__esModule)return r;var t=Object.create(null);if(i.r(t),Object.defineProperty(t,"default",{enumerable:!0,value:r}),2&e&&"string"!=typeof r)for(var n in r)i.d(t,n,function(e){return r[e]}.bind(null,n));return t},i.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return i.d(r,"a",r),r},i.o=function(e,r){return Object.prototype.hasOwnProperty.call(e,r)},i.p="./";var r=this["webpackJsonp@agreed/ui"]=this["webpackJsonp@agreed/ui"]||[],n=r.push.bind(r);r.push=e,r=r.slice();for(var o=0;o<r.length;o++)e(r[o]);var s=n;f()}([])</script><script src="./static/js/2.b28c1fbe.chunk.js"></script><script src="./static/js/main.ef43f0f5.chunk.js"></script></body></html>
<!doctype html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1,shrink-to-fit=no"><meta name="theme-color" content="#000000"><link rel="manifest" href="./manifest.json"><link rel="shortcut icon" href="./favicon.png"><title>Agreed UI</title><script defer="defer" src="./static/js/main.9b5da592.js"></script><link href="./static/css/main.4e871676.css" rel="stylesheet"></head><body><noscript>You need to enable JavaScript to run this app.</noscript><div id="root"></div><script>window.TITLE='"<%= title %>"',window.AGREES="<%= agrees %>"</script></body></html>
8 changes: 5 additions & 3 deletions packages/ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
"start:dev:server": "react-scripts start",
"build": "node scripts/build.js",
"build:dev": "PUBLIC_URL=./ react-scripts build",
"lint": "eslint 'src/**/*.js' --fix",
"lintfix": "eslint 'src/**/*.js' --fix"
"lint": "eslint -c .eslintrc.json 'src/**/*.js' --fix",
"lintfix": "eslint -c .eslintrc.json 'src/**/*.js' --fix"
},
"bin": {
"agreed-ui": "bin/agreed-ui.js"
Expand All @@ -22,6 +22,7 @@
},
"dependencies": {
"@agreed/core": "^5.3.2-alpha.0",
"@babel/plugin-proposal-private-property-in-object": "^7.21.11",
"colo": "1.0.0",
"express": "4.18.2",
"fs-extra": "11.1.0",
Expand All @@ -31,8 +32,9 @@
"serialize-javascript": "6.0.1"
},
"devDependencies": {
"@babel/eslint-parser": "^7.23.10",
"@babel/preset-react": "^7.23.3",
"axios": "0.27.2",
"babel-eslint": "10.1.0",
"classnames": "2.3.1",
"eslint": "7.32.0",
"eslint-config-prettier": "8.7.0",
Expand Down
32 changes: 14 additions & 18 deletions packages/ui/server/lib/getAgreements.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,29 +7,25 @@ const requireUncached = require('@agreed/core/lib/require_hook/requireUncached')
const format = require('@agreed/core/lib/template/format')
const { parseSchema } = require('json-schema-to-flow-type')

module.exports = function(options) {
const agreesPath = path.resolve(options.path)
module.exports = function (options) {
const agreesPath = path.resolve(options.path ?? '')
const base = path.dirname(agreesPath)

register()

const agrees = [].concat(requireUncached(agreesPath))
return agrees.map((agree) => completion(agree, base)).map((agree) => {
agree.request.headers_formatted = format(
agree.request.headers,
agree.request.values
)
agree.request.formatted = format(agree.request.body, agree.request.values)

agree.response.formatted = format(
agree.response.body,
agree.response.values
)
return agrees
.map((agree) => completion(agree, base))
.map((agree) => {
agree.request.headers_formatted = format(agree.request.headers, agree.request.values)
agree.request.formatted = format(agree.request.body, agree.request.values)

agree.response.formatted = format(agree.response.body, agree.response.values)

if (agree.response.schema) {
agree.response.flowtype = parseSchema(agree.response.schema)
}
if (agree.response.schema) {
agree.response.flowtype = parseSchema(agree.response.schema)
}

return agree
})
return agree
})
}
2 changes: 1 addition & 1 deletion packages/ui/src/components/Body/index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React, { Component } from 'react'
import PropTypes from 'prop-types'
import JSONTree from 'react-json-tree'
import { JSONTree } from 'react-json-tree'
import classNames from 'classnames'
import './styles.css'

Expand Down

0 comments on commit 897618f

Please sign in to comment.