Adding Linting and Formatting (#77)

Addresses #11 item "Linting/formatting (eg eslnt, prettier)":
* Adding eslint, prettier, and config targeting Google, typescript, and both nodejs and client builds
* Addressing linter-found issues
* Adding lint and lint:fix commands
* Adding documentation
* Renaming workflow and adding lint check
* Adding documentation about VSCode linting/formatting, ran formatting on a few files, set up exclude list for gatsby develop, setup build to fail on error
This commit is contained in:
Nat Hillard 2021-05-25 16:21:21 -04:00 committed by GitHub
parent 16a9e67db0
commit a432a0d8c9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
16 changed files with 310 additions and 208 deletions

View file

@ -33,6 +33,8 @@ jobs:
run: npm run build --if-present
- name: Get directory contents
run: ls -la public
- name: Lint
run: npm run lint
- name: Test
run: npm test
- name: Upload Artifact

30
client/.eslintrc.js Normal file
View file

@ -0,0 +1,30 @@
module.exports = {
'env': {
'browser': true,
'es2021': true,
'node': true,
},
'extends': [
'plugin:react/recommended',
'google',
],
'parser': '@typescript-eslint/parser',
'parserOptions': {
'ecmaFeatures': {
'jsx': true,
},
'ecmaVersion': 12,
'sourceType': 'module',
},
'plugins': [
'react',
'@typescript-eslint',
],
'rules': {
},
'settings': {
'react': {
'version': 'detect',
},
},
};

1
client/.gitignore vendored
View file

@ -1,3 +1,4 @@
node_modules/
.cache/
public
.eslintcache

View file

@ -31,4 +31,4 @@
"sourceMaps": false
}
]
}
}

View file

@ -1,5 +1,25 @@
# Justice40 Client
## Linting and Formatting
This project uses [ESLint](https://eslint.org/) for code linting and [Prettier](https://prettier.io/) for formatting. They are integrated via [gatsby-plugin-prettier-eslint](https://www.gatsbyjs.com/plugins/gatsby-plugin-prettier-eslint/).
Linting is a required check before merges can happen, please lint your code, for the sake of consistency!
To use:
1. During development:
1. `npx gatsby develop` will automatically run prettier and eslint during development as files change, watch the console for updates.
2. Alternatively, if you're using VSCode:
1. Install the [Prettier](https://marketplace.visualstudio.com/items?itemName=esbenp.prettier-vscode) and [ESLint](https://marketplace.visualstudio.com/items?itemName=dbaeumer.vscode-eslint) plugins
2. Enable `editor.formatOnSave`, and optionally `"editor.codeActionsOnSave": {"source.fixAll": true},` to apply settings on save
2. Before a PR: `npm run lint:fix` can be run locally to apply auto-fixes to issues that can be fixed
3. Before merge (automatic): `npm run lint` is run against all PRs by a github action.
The ruleset is simply the base ruleset + [Google](https://github.com/google/eslint-config-google).
## Localization
### About

View file

@ -1 +1 @@
import './src/styles/global.scss';
import './src/styles/global.scss';

View file

@ -1,41 +1,57 @@
module.exports = {
/*
This is to workaround the following error when building locally:
Warning: React.createElement: type is invalid -- expected a string
(for built-in components) or a class/function (for composite components) but got: undefined.
at IndexPage
We will need to fix this before running `gatsby build`
*/
flags: {
DEV_SSR: false
},
siteMetadata: {
title: "Justice40",
title: 'Justice40',
},
pathPrefix: "/justice40-tool",
pathPrefix: '/justice40-tool',
plugins: [
{
resolve: 'gatsby-plugin-sass',
options: {
cssLoaderOptions: {
modules: {
exportLocalsConvention: 'camelCaseOnly'
}
}
}
exportLocalsConvention: 'camelCaseOnly',
},
},
},
},
{
resolve: `gatsby-plugin-intl`,
options: {
// language JSON resource path
path: `${__dirname}/src/intl`,
// supported language
languages: [`en`, `es`],
// language file path
defaultLanguage: `en`,
// option to redirect to `/en` when connecting `/`
redirect: true,
resolve: `gatsby-plugin-intl`,
options: {
// language JSON resource path
path: `${__dirname}/src/intl`,
// supported language
languages: [`en`, `es`],
// language file path
defaultLanguage: `en`,
// option to redirect to `/en` when connecting `/`
redirect: true,
},
},
{
resolve: 'gatsby-plugin-prettier-eslint',
options: {
prettier: {
patterns: [
// The pattern "**/*.{js,jsx,ts,tsx}" is
// not used because we will rely on `eslint --fix`
'**/*.{css,scss,less}',
'**/*.{json,json5}',
'**/*.{graphql}',
'**/*.{md,mdx}',
'**/*.{html}',
'**/*.{yaml,yml}',
],
},
eslint: {
patterns: '**/*.{js,jsx,ts,tsx}',
ignorePatterns: ['public', 'node_modules', '*scss.d.ts'],
failOnError: true,
customOptions: {
fix: true,
cache: true,
},
},
},
},
],
};

View file

@ -1,9 +1,7 @@
path = require('path');
// Disable references to window from trussworks/uswds
// See here: https://www.gatsbyjs.com/docs/debugging-html-builds/#fixing-third-party-modules
exports.onCreateWebpackConfig = ({ stage, loaders, actions }) => {
exports.onCreateWebpackConfig = ({stage, loaders, actions}) => {
actions.setWebpackConfig({
devtool: 'eval-source-map',
});
}
});
};

231
client/package-lock.json generated
View file

@ -2145,9 +2145,9 @@
}
},
"@types/react": {
"version": "17.0.6",
"resolved": "https://registry.npmjs.org/@types/react/-/react-17.0.6.tgz",
"integrity": "sha512-u/TtPoF/hrvb63LdukET6ncaplYsvCvmkceasx8oG84/ZCsoLxz9Z/raPBP4lTAiWW1Jb889Y9svHmv8R26dWw==",
"version": "17.0.7",
"resolved": "https://registry.npmjs.org/@types/react/-/react-17.0.7.tgz",
"integrity": "sha512-lBc3fY20hRFQ/pXQT2XdtmpJeXZnRH8N+WPnEzEfPTzuKmaJTA7k/xGWHBaPvKceKpbf0ZnMlLWY/0sFZ5rfkw==",
"requires": {
"@types/prop-types": "*",
"@types/scheduler": "*",
@ -3034,9 +3034,9 @@
}
},
"babel-plugin-remove-graphql-queries": {
"version": "3.5.0",
"resolved": "https://registry.npmjs.org/babel-plugin-remove-graphql-queries/-/babel-plugin-remove-graphql-queries-3.5.0.tgz",
"integrity": "sha512-JGVMfrPk7TwRSDxs8Rro748SbSrj+5h4iQvbE5dfUIUOELVoPm9FrhiEn/kIMvwd+nMgn8td9sg0Pp24HtjZlQ=="
"version": "3.6.0",
"resolved": "https://registry.npmjs.org/babel-plugin-remove-graphql-queries/-/babel-plugin-remove-graphql-queries-3.6.0.tgz",
"integrity": "sha512-8BEpm4gnHJhAcQ/K+yvY+/LINPljBgzncYnpLLhXa4rHa5SGsD0EIjWC0yzcP6WtMlIAqUf2cWz2itGci7FrvA=="
},
"babel-plugin-transform-react-remove-prop-types": {
"version": "0.4.24",
@ -3044,9 +3044,9 @@
"integrity": "sha512-eqj0hVcJUR57/Ug2zE1Yswsw4LhuqqHhD+8v120T1cl3kjg76QwtyBrdIk4WVwK+lAhBJVYCd/v+4nc4y+8JsA=="
},
"babel-preset-gatsby": {
"version": "1.5.0",
"resolved": "https://registry.npmjs.org/babel-preset-gatsby/-/babel-preset-gatsby-1.5.0.tgz",
"integrity": "sha512-XV66eQQhfTgx0V3KtIo2fSZYUpL9zXa8jO91kApYHOAqZa9vuMC1leo0X5CQQofeyaJTHIlrGnRcAhH//qADHQ==",
"version": "1.6.0",
"resolved": "https://registry.npmjs.org/babel-preset-gatsby/-/babel-preset-gatsby-1.6.0.tgz",
"integrity": "sha512-d/5RhTIQo7Q66tjzhvHA3RfD037tODIA7JZwsjsrtW1cvVWB7+k60GT4lSziR2U6cZB46XXY09PBXRrrFQmjZQ==",
"requires": {
"@babel/plugin-proposal-class-properties": "^7.12.1",
"@babel/plugin-proposal-nullish-coalescing-operator": "^7.12.1",
@ -3061,8 +3061,8 @@
"babel-plugin-dynamic-import-node": "^2.3.3",
"babel-plugin-macros": "^2.8.0",
"babel-plugin-transform-react-remove-prop-types": "^0.4.24",
"gatsby-core-utils": "^2.5.0",
"gatsby-legacy-polyfills": "^1.5.0"
"gatsby-core-utils": "^2.6.0",
"gatsby-legacy-polyfills": "^1.6.0"
}
},
"backo2": {
@ -4113,9 +4113,9 @@
}
},
"create-gatsby": {
"version": "1.5.0",
"resolved": "https://registry.npmjs.org/create-gatsby/-/create-gatsby-1.5.0.tgz",
"integrity": "sha512-oEGYAvysG5OogLp06mp6Hk84ay7kirCIe2/XAWAz5r/11SIzAL/bvcOF5FDTnRdWHrYNu8JZHmfab6NqlvpiWw=="
"version": "1.6.0",
"resolved": "https://registry.npmjs.org/create-gatsby/-/create-gatsby-1.6.0.tgz",
"integrity": "sha512-mNPBiTZ9aH24I2YInaiBoXDjPgibsystLsXXWpM5miIJpA6rZrJSRtHVGfXUxZXsKHLc/at2vNrFQbsVue3Nyg=="
},
"create-require": {
"version": "1.1.1",
@ -4815,9 +4815,9 @@
"integrity": "sha1-s55/HabrCnW6nBcySzR1PEfgZU0="
},
"dns-packet": {
"version": "1.3.1",
"resolved": "https://registry.npmjs.org/dns-packet/-/dns-packet-1.3.1.tgz",
"integrity": "sha512-0UxfQkMhYAUaZI+xrNZOz/as5KgDU0M/fQ9b6SpkyLbk3GEswDi6PADJVaYJradtRVsRIlF1zLyOodbcTCDzUg==",
"version": "1.3.3",
"resolved": "https://registry.npmjs.org/dns-packet/-/dns-packet-1.3.3.tgz",
"integrity": "sha512-dDwDMOJU+m6Qx+LhltSV+BWNrMaTqx3eXkAqgt/iouWTXGZMffg1rOSnG2xa3lWqmJ9xTBc7fgIe/css4S1rxA==",
"requires": {
"ip": "^1.1.0",
"safe-buffer": "^5.0.1"
@ -4909,9 +4909,9 @@
"integrity": "sha1-WQxhFWsK4vTwJVcyoViyZrxWsh0="
},
"electron-to-chromium": {
"version": "1.3.737",
"resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.3.737.tgz",
"integrity": "sha512-P/B84AgUSQXaum7a8m11HUsYL8tj9h/Pt5f7Hg7Ty6bm5DxlFq+e5+ouHUoNQMsKDJ7u4yGfI8mOErCmSH9wyg=="
"version": "1.3.738",
"resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.3.738.tgz",
"integrity": "sha512-vCMf4gDOpEylPSLPLSwAEsz+R3ShP02Y3cAKMZvTqule3XcPp7tgc/0ESI7IS6ZeyBlGClE50N53fIOkcIVnpw=="
},
"email-addresses": {
"version": "3.1.0",
@ -5065,9 +5065,9 @@
}
},
"es-abstract": {
"version": "1.18.0",
"resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.18.0.tgz",
"integrity": "sha512-LJzK7MrQa8TS0ja2w3YNLzUgJCGPdPOV1yVvezjNnS89D+VR08+Szt2mz3YB2Dck/+w5tfIq/RoUAFqJJGM2yw==",
"version": "1.18.1",
"resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.18.1.tgz",
"integrity": "sha512-LEPRJp87wbQP5Skd3aMpAQePWPC3axO9VD3WmgFYL96dylzMi4xd2G4e/6lrH+wkSYchcPO+0hrSTugYOBjMdQ==",
"requires": {
"call-bind": "^1.0.2",
"es-to-primitive": "^1.2.1",
@ -5077,14 +5077,14 @@
"has-symbols": "^1.0.2",
"is-callable": "^1.2.3",
"is-negative-zero": "^2.0.1",
"is-regex": "^1.1.2",
"is-string": "^1.0.5",
"object-inspect": "^1.9.0",
"is-regex": "^1.1.3",
"is-string": "^1.0.6",
"object-inspect": "^1.10.3",
"object-keys": "^1.1.1",
"object.assign": "^4.1.2",
"string.prototype.trimend": "^1.0.4",
"string.prototype.trimstart": "^1.0.4",
"unbox-primitive": "^1.0.0"
"unbox-primitive": "^1.0.1"
}
},
"es-module-lexer": {
@ -5300,6 +5300,12 @@
}
}
},
"eslint-config-google": {
"version": "0.14.0",
"resolved": "https://registry.npmjs.org/eslint-config-google/-/eslint-config-google-0.14.0.tgz",
"integrity": "sha512-WsbX4WbjuMvTdeVL6+J3rK1RGhCTqjsFjX7UMSMgZiyxxaNLkoJENbrGExzERFeoTpGw3F3FypTiWAP9ZXzkEw==",
"dev": true
},
"eslint-config-react-app": {
"version": "6.0.0",
"resolved": "https://registry.npmjs.org/eslint-config-react-app/-/eslint-config-react-app-6.0.0.tgz",
@ -6593,9 +6599,9 @@
"integrity": "sha1-GwqzvVU7Kg1jmdKcDj6gslIHgyc="
},
"gatsby": {
"version": "3.5.1",
"resolved": "https://registry.npmjs.org/gatsby/-/gatsby-3.5.1.tgz",
"integrity": "sha512-wmhU5dsm2Is/aFgNyxjnuVMNK1chP0Kg5cS15JWAk593xk/hUj0i/lomirNmzvl+2Yk2LC8KZ0M/8OM4cocrKg==",
"version": "3.6.0",
"resolved": "https://registry.npmjs.org/gatsby/-/gatsby-3.6.0.tgz",
"integrity": "sha512-gRyIyXHUNUx4YOU9HSN0rT7fM3whKO1BhPtghrG66eqgrK3gk95UofAJYZWb9xwer7cK93y3QMhkS8pfKKvl7g==",
"requires": {
"@babel/code-frame": "^7.10.4",
"@babel/core": "^7.12.3",
@ -6620,8 +6626,8 @@
"babel-plugin-add-module-exports": "^1.0.4",
"babel-plugin-dynamic-import-node": "^2.3.3",
"babel-plugin-lodash": "^3.3.4",
"babel-plugin-remove-graphql-queries": "^3.5.0",
"babel-preset-gatsby": "^1.5.0",
"babel-plugin-remove-graphql-queries": "^3.6.0",
"babel-preset-gatsby": "^1.6.0",
"better-opn": "^2.0.0",
"bluebird": "^3.7.2",
"body-parser": "^1.19.0",
@ -6663,16 +6669,16 @@
"find-cache-dir": "^3.3.1",
"fs-exists-cached": "1.0.0",
"fs-extra": "^8.1.0",
"gatsby-cli": "^3.5.0",
"gatsby-core-utils": "^2.5.0",
"gatsby-graphiql-explorer": "^1.5.0",
"gatsby-legacy-polyfills": "^1.5.0",
"gatsby-link": "^3.5.0",
"gatsby-plugin-page-creator": "^3.5.0",
"gatsby-plugin-typescript": "^3.5.0",
"gatsby-plugin-utils": "^1.5.0",
"gatsby-react-router-scroll": "^4.5.0",
"gatsby-telemetry": "^2.5.0",
"gatsby-cli": "^3.6.0",
"gatsby-core-utils": "^2.6.0",
"gatsby-graphiql-explorer": "^1.6.0",
"gatsby-legacy-polyfills": "^1.6.0",
"gatsby-link": "^3.6.0",
"gatsby-plugin-page-creator": "^3.6.0",
"gatsby-plugin-typescript": "^3.6.0",
"gatsby-plugin-utils": "^1.6.0",
"gatsby-react-router-scroll": "^4.6.0",
"gatsby-telemetry": "^2.6.0",
"glob": "^7.1.6",
"got": "8.3.2",
"graphql": "^15.4.0",
@ -6804,9 +6810,9 @@
}
},
"gatsby-cli": {
"version": "3.5.0",
"resolved": "https://registry.npmjs.org/gatsby-cli/-/gatsby-cli-3.5.0.tgz",
"integrity": "sha512-Z7MsqYK7tZJV8gxJilu6ieWvO+RxzFz2Eizineqm4jS1WRhiaK8aqIECRf/kTiT4NQXsxbdmdr9CexauVUEqeQ==",
"version": "3.6.0",
"resolved": "https://registry.npmjs.org/gatsby-cli/-/gatsby-cli-3.6.0.tgz",
"integrity": "sha512-GJ0BviJw3qnONdoNpCvqgRA8jxYk7rpqi+7MrvT0U+YMcT2HGhZbhY0RxlZqYRL8qOCJTtLB/N4Z7cCUwi8g1w==",
"requires": {
"@babel/code-frame": "^7.10.4",
"@types/common-tags": "^1.8.0",
@ -6816,14 +6822,14 @@
"common-tags": "^1.8.0",
"configstore": "^5.0.1",
"convert-hrtime": "^3.0.0",
"create-gatsby": "^1.5.0",
"create-gatsby": "^1.6.0",
"envinfo": "^7.7.3",
"execa": "^3.4.0",
"fs-exists-cached": "^1.0.0",
"fs-extra": "^8.1.0",
"gatsby-core-utils": "^2.5.0",
"gatsby-recipes": "^0.16.0",
"gatsby-telemetry": "^2.5.0",
"gatsby-core-utils": "^2.6.0",
"gatsby-recipes": "^0.17.0",
"gatsby-telemetry": "^2.6.0",
"hosted-git-info": "^3.0.6",
"is-valid-path": "^0.1.1",
"joi": "^17.4.0",
@ -6961,9 +6967,9 @@
}
},
"gatsby-cli": {
"version": "3.5.0",
"resolved": "https://registry.npmjs.org/gatsby-cli/-/gatsby-cli-3.5.0.tgz",
"integrity": "sha512-Z7MsqYK7tZJV8gxJilu6ieWvO+RxzFz2Eizineqm4jS1WRhiaK8aqIECRf/kTiT4NQXsxbdmdr9CexauVUEqeQ==",
"version": "3.6.0",
"resolved": "https://registry.npmjs.org/gatsby-cli/-/gatsby-cli-3.6.0.tgz",
"integrity": "sha512-GJ0BviJw3qnONdoNpCvqgRA8jxYk7rpqi+7MrvT0U+YMcT2HGhZbhY0RxlZqYRL8qOCJTtLB/N4Z7cCUwi8g1w==",
"dev": true,
"requires": {
"@babel/code-frame": "^7.10.4",
@ -6974,14 +6980,14 @@
"common-tags": "^1.8.0",
"configstore": "^5.0.1",
"convert-hrtime": "^3.0.0",
"create-gatsby": "^1.5.0",
"create-gatsby": "^1.6.0",
"envinfo": "^7.7.3",
"execa": "^3.4.0",
"fs-exists-cached": "^1.0.0",
"fs-extra": "^8.1.0",
"gatsby-core-utils": "^2.5.0",
"gatsby-recipes": "^0.16.0",
"gatsby-telemetry": "^2.5.0",
"gatsby-core-utils": "^2.6.0",
"gatsby-recipes": "^0.17.0",
"gatsby-telemetry": "^2.6.0",
"hosted-git-info": "^3.0.6",
"is-valid-path": "^0.1.1",
"joi": "^17.4.0",
@ -7186,9 +7192,9 @@
}
},
"gatsby-core-utils": {
"version": "2.5.0",
"resolved": "https://registry.npmjs.org/gatsby-core-utils/-/gatsby-core-utils-2.5.0.tgz",
"integrity": "sha512-YbKv7FLpeTCts28bv0H2lSuHrKgUxnsC1ZG1PPydOheQgPW9G8pdNlYvwZzGJmmS7rBcC/w859ss90wlvF6GEw==",
"version": "2.6.0",
"resolved": "https://registry.npmjs.org/gatsby-core-utils/-/gatsby-core-utils-2.6.0.tgz",
"integrity": "sha512-d8a/iblc3wIrLEOWTUcoK5uYE2DrvlQmeulx6DK3NY49KD8jet8ozB6T5GA1CftsvowWeO6aaDnoWDbTxIxTRA==",
"requires": {
"ci-info": "2.0.0",
"configstore": "^5.0.1",
@ -7201,17 +7207,17 @@
}
},
"gatsby-graphiql-explorer": {
"version": "1.5.0",
"resolved": "https://registry.npmjs.org/gatsby-graphiql-explorer/-/gatsby-graphiql-explorer-1.5.0.tgz",
"integrity": "sha512-u0fa3ZakFgnzHLH6zEsacnKgitqcuLdeqmQ+I6mUrRm9ijKOs884Or5nFYziTVBGbXyVyaAiK4rjxwM1BjEETw==",
"version": "1.6.0",
"resolved": "https://registry.npmjs.org/gatsby-graphiql-explorer/-/gatsby-graphiql-explorer-1.6.0.tgz",
"integrity": "sha512-RNkHXELyIQKo5h2+Y92NQ/bfBm7I53MqyywRN7nXPwqwRb+ymv0/3rT6pY69WTXc1ORKrEZazmWv3JWhrVYKbw==",
"requires": {
"@babel/runtime": "^7.12.5"
}
},
"gatsby-legacy-polyfills": {
"version": "1.5.0",
"resolved": "https://registry.npmjs.org/gatsby-legacy-polyfills/-/gatsby-legacy-polyfills-1.5.0.tgz",
"integrity": "sha512-aRVk/ArXt7majaxlIKftybY7V6Q22MKiBaQcVWp2Sn7P5xc8M7WO4B7D2vgaEqTxfOmopcWuzHSnCbvMgSPe+A==",
"version": "1.6.0",
"resolved": "https://registry.npmjs.org/gatsby-legacy-polyfills/-/gatsby-legacy-polyfills-1.6.0.tgz",
"integrity": "sha512-Qqk+THLhQhlYpdMsOcFwBmSrF06BT273rQ4he4g5YGg3l57wpzHQX2zt8yuLIE/6zzA5q/hTYg9MFIniYRBG/A==",
"requires": {
"core-js-compat": "3.9.0"
},
@ -7233,9 +7239,9 @@
}
},
"gatsby-link": {
"version": "3.5.0",
"resolved": "https://registry.npmjs.org/gatsby-link/-/gatsby-link-3.5.0.tgz",
"integrity": "sha512-zmf64g8gC7GfZkJSP93MPFqhuKF3tEW/BowHNPqL0VJ/5GbhJrNOfL7FZCwAUc7F2LNsw3Uz7DvKpMY7PFghQg==",
"version": "3.6.0",
"resolved": "https://registry.npmjs.org/gatsby-link/-/gatsby-link-3.6.0.tgz",
"integrity": "sha512-lvRAA+RfH7DrId1gfGrCW1Ox1weMZnVyOaJwQZaTBXoxQ2H2xv5AkIS08GPm00Il5wnHfOUsh/qHxEW/Q6+ELQ==",
"requires": {
"@babel/runtime": "^7.12.5",
"@types/reach__router": "^1.3.7",
@ -7243,15 +7249,15 @@
}
},
"gatsby-page-utils": {
"version": "1.5.0",
"resolved": "https://registry.npmjs.org/gatsby-page-utils/-/gatsby-page-utils-1.5.0.tgz",
"integrity": "sha512-hL6bY2sYuO7Nk6W6lQw9TBpunMPcZvp3LEZ9WS1YfHWfygVm6v8hKOn09Wsv0n+CSjBH/EJ3ocX5iDlSYkqbKg==",
"version": "1.6.0",
"resolved": "https://registry.npmjs.org/gatsby-page-utils/-/gatsby-page-utils-1.6.0.tgz",
"integrity": "sha512-/jryNkO8F9iYDAFl0EYyZbns1CUW/rEUiIkb3NOGwitHvTSw8IEQPNORBOvhKzYWfGTI362p/hR/u2U7hna/Qg==",
"requires": {
"@babel/runtime": "^7.12.5",
"bluebird": "^3.7.2",
"chokidar": "^3.5.1",
"fs-exists-cached": "^1.0.0",
"gatsby-core-utils": "^2.5.0",
"gatsby-core-utils": "^2.6.0",
"glob": "^7.1.6",
"lodash": "^4.17.21",
"micromatch": "^4.0.2"
@ -7272,25 +7278,38 @@
}
},
"gatsby-plugin-page-creator": {
"version": "3.5.0",
"resolved": "https://registry.npmjs.org/gatsby-plugin-page-creator/-/gatsby-plugin-page-creator-3.5.0.tgz",
"integrity": "sha512-0rH+WWnp8sgNyyKmEtcQAt7EGcBHom6r8oZYqOaVXJsgwr+uzTjg4ncz+Qcz+rb6lMHFY6ajxStFvU/VzIMAxA==",
"version": "3.6.0",
"resolved": "https://registry.npmjs.org/gatsby-plugin-page-creator/-/gatsby-plugin-page-creator-3.6.0.tgz",
"integrity": "sha512-59lJ0kXzDpJZgPKYFP/foK5Gsc/+TT/O50aTscZP5l3Hpyknnb7AIjKt0axaN4BQuc6OOmRmg1z9TcjXMwnytg==",
"requires": {
"@babel/traverse": "^7.12.5",
"@sindresorhus/slugify": "^1.1.2",
"chokidar": "^3.5.1",
"fs-exists-cached": "^1.0.0",
"gatsby-core-utils": "^2.5.0",
"gatsby-page-utils": "^1.5.0",
"gatsby-telemetry": "^2.5.0",
"gatsby-core-utils": "^2.6.0",
"gatsby-page-utils": "^1.6.0",
"gatsby-telemetry": "^2.6.0",
"globby": "^11.0.3",
"lodash": "^4.17.21"
}
},
"gatsby-plugin-prettier-eslint": {
"version": "1.0.6",
"resolved": "https://registry.npmjs.org/gatsby-plugin-prettier-eslint/-/gatsby-plugin-prettier-eslint-1.0.6.tgz",
"integrity": "sha512-M9FCWizeGdB1U4Jcas8rvIa/jwKiJGK84C6hnRr6FKCsM66HlCL7qfverhi1GNISmuCToxCuvjbkKypzRkLuHA==",
"dev": true,
"requires": {
"@babel/runtime": "^7.8.7",
"chokidar": "^3.3.1",
"fast-glob": "^3.2.2",
"lodash.mergewith": "^4.6.2",
"picomatch": "^2.2.2"
}
},
"gatsby-plugin-sass": {
"version": "4.5.0",
"resolved": "https://registry.npmjs.org/gatsby-plugin-sass/-/gatsby-plugin-sass-4.5.0.tgz",
"integrity": "sha512-0FP4aDI/3ts83X+cA0IVGI+Wm0spOGT4AFIB0KhMlTdcMEgOq8nWmD//FHPMEBQ73sZiNF2fnfEFQAvYW1HTkg==",
"version": "4.6.0",
"resolved": "https://registry.npmjs.org/gatsby-plugin-sass/-/gatsby-plugin-sass-4.6.0.tgz",
"integrity": "sha512-tc82jDRlo8qwdjD2rFE7qA43VnDxw5DcJ17UK5HjKT2AaF4v049VBUT7eGLe41pPGsfwfm563nCtzORcNbkyCA==",
"dev": true,
"requires": {
"@babel/runtime": "^7.12.5",
@ -7336,9 +7355,9 @@
}
},
"gatsby-plugin-typescript": {
"version": "3.5.0",
"resolved": "https://registry.npmjs.org/gatsby-plugin-typescript/-/gatsby-plugin-typescript-3.5.0.tgz",
"integrity": "sha512-8Nd4iklXvf0R7kp3H1zHw7KlIniGsz0fc0iBZuWoT/ES43EkZqEHfJWUszJo1wyB1RM3nyob6I+mWbLsrl11Zw==",
"version": "3.6.0",
"resolved": "https://registry.npmjs.org/gatsby-plugin-typescript/-/gatsby-plugin-typescript-3.6.0.tgz",
"integrity": "sha512-qkxtdGOr/VA3NfC51PMasoXgoX0V8hiXVGbZuBBEZMYuj4j7BKPzShXb7TeqDKI2LQvO3r5sQlxGjfXNAOB0qg==",
"requires": {
"@babel/core": "^7.12.3",
"@babel/plugin-proposal-nullish-coalescing-operator": "^7.12.1",
@ -7346,29 +7365,29 @@
"@babel/plugin-proposal-optional-chaining": "^7.12.1",
"@babel/preset-typescript": "^7.12.1",
"@babel/runtime": "^7.12.5",
"babel-plugin-remove-graphql-queries": "^3.5.0"
"babel-plugin-remove-graphql-queries": "^3.6.0"
}
},
"gatsby-plugin-utils": {
"version": "1.5.0",
"resolved": "https://registry.npmjs.org/gatsby-plugin-utils/-/gatsby-plugin-utils-1.5.0.tgz",
"integrity": "sha512-IqCXOGTC+WRtzLUhEbJzR9RlumDGtN/xmsl41AOgfeJvfdeXiomm9nrlCs915XDZh/fYa5MbRpf7Xu4S3skhLA==",
"version": "1.6.0",
"resolved": "https://registry.npmjs.org/gatsby-plugin-utils/-/gatsby-plugin-utils-1.6.0.tgz",
"integrity": "sha512-RDHaPBvVE8v9EQvPAUyXZzoDFKo0t0j7qJHDvFQc0PfcX0EmQWXNkFd7PN+DVz8nPfuhLIV6GKS3WQXYbiCLIA==",
"requires": {
"joi": "^17.2.1"
}
},
"gatsby-react-router-scroll": {
"version": "4.5.0",
"resolved": "https://registry.npmjs.org/gatsby-react-router-scroll/-/gatsby-react-router-scroll-4.5.0.tgz",
"integrity": "sha512-iE58ZuyMpgfaeuzkcR5P3y6RKYRPfGYYkIeYnXDJ2fwYNpKzPOcf0kPH12fBtb2ZKjHMy4ZmyqHppKqClvu0GQ==",
"version": "4.6.0",
"resolved": "https://registry.npmjs.org/gatsby-react-router-scroll/-/gatsby-react-router-scroll-4.6.0.tgz",
"integrity": "sha512-sgg55OmxAlLzFCrpx9C01QgVNiSVGgLKvrAVlsN8UxltNZSO+iw4f5/Gd3vOSyb6sNYVJCYnmfvQ6uV2pZs3bg==",
"requires": {
"@babel/runtime": "^7.12.5"
}
},
"gatsby-recipes": {
"version": "0.16.0",
"resolved": "https://registry.npmjs.org/gatsby-recipes/-/gatsby-recipes-0.16.0.tgz",
"integrity": "sha512-xS48KK4F/CLxlaHBq4AbTL6/2uSdfTdZuSrNPNPTvNnm9FMiot64e5SZpnZOMz4Wnts5pGPAVqnhfL37iy6V1g==",
"version": "0.17.0",
"resolved": "https://registry.npmjs.org/gatsby-recipes/-/gatsby-recipes-0.17.0.tgz",
"integrity": "sha512-tC2xUa05zrUp77DTyQE11ILhFiqv9JYxBHhh47b7tJGiLAU1XhjxZH0uFZ109r9wEeZjxTYOYkyoiTu+0Ps4pw==",
"requires": {
"@babel/core": "^7.12.3",
"@babel/generator": "^7.12.5",
@ -7393,8 +7412,8 @@
"express": "^4.17.1",
"express-graphql": "^0.9.0",
"fs-extra": "^8.1.0",
"gatsby-core-utils": "^2.5.0",
"gatsby-telemetry": "^2.5.0",
"gatsby-core-utils": "^2.6.0",
"gatsby-telemetry": "^2.6.0",
"glob": "^7.1.6",
"graphql": "^15.4.0",
"graphql-compose": "~7.25.0",
@ -7449,9 +7468,9 @@
}
},
"gatsby-telemetry": {
"version": "2.5.0",
"resolved": "https://registry.npmjs.org/gatsby-telemetry/-/gatsby-telemetry-2.5.0.tgz",
"integrity": "sha512-PbyYw74t/RLVbEWicjAdrCMttV1GSbuHZit0PsVPqqwNlL1LalJa/V7lcVMqqGrEbkB+fUoKkk1u2o+TDgvIng==",
"version": "2.6.0",
"resolved": "https://registry.npmjs.org/gatsby-telemetry/-/gatsby-telemetry-2.6.0.tgz",
"integrity": "sha512-ENrhT4tkETj9Gq48d+ziiyNTX8Q8/5EyqqWvDUTCSefeHV5xpBclJ+CEnxZkmkEa/QSoBCpjws2VbxnTmRwjWA==",
"requires": {
"@babel/code-frame": "^7.10.4",
"@babel/runtime": "^7.12.5",
@ -7461,7 +7480,7 @@
"boxen": "^4.2.0",
"configstore": "^5.0.1",
"fs-extra": "^8.1.0",
"gatsby-core-utils": "^2.5.0",
"gatsby-core-utils": "^2.6.0",
"git-up": "^4.0.2",
"is-docker": "^2.1.1",
"lodash": "^4.17.21",
@ -9528,6 +9547,12 @@
"resolved": "https://registry.npmjs.org/lodash.merge/-/lodash.merge-4.6.2.tgz",
"integrity": "sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ=="
},
"lodash.mergewith": {
"version": "4.6.2",
"resolved": "https://registry.npmjs.org/lodash.mergewith/-/lodash.mergewith-4.6.2.tgz",
"integrity": "sha512-GK3g5RPZWTRSeLSpgP8Xhra+pnjBC56q9FZYe1d5RN3TJ35dbkGy3YqBSMbyCrlbi+CM9Z3Jk5yTL7RCsqboyQ==",
"dev": true
},
"lodash.truncate": {
"version": "4.4.2",
"resolved": "https://registry.npmjs.org/lodash.truncate/-/lodash.truncate-4.4.2.tgz",
@ -10839,9 +10864,9 @@
"integrity": "sha1-QRyttXTFoUDTpLGRDUDYDMn0C0A="
},
"path-parse": {
"version": "1.0.6",
"resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.6.tgz",
"integrity": "sha512-GSmOT2EbHrINBf9SR7CDELwlJ8AENk3Qn7OikK4nFYAu3Ote2+JYNVvkpAEQm3/TLNEJFD/xZJjzyxg3KBWOzw=="
"version": "1.0.7",
"resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.7.tgz",
"integrity": "sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw=="
},
"path-to-regexp": {
"version": "0.1.7",

View file

@ -14,6 +14,8 @@
"serve": "gatsby serve",
"clean": "gatsby clean",
"deploy": "gatsby build --prefix-paths && gh-pages -d public",
"lint": "eslint './src/**/*.{ts,tsx}' --ignore-pattern node_modules/ --ignore-pattern public --ignore-pattern *scss.d.ts",
"lint:fix": "npm run lint -- --quiet --fix",
"intl:extract": "formatjs extract 'src/(pages|components)/*.tsx' --out-file src/intl/en.json",
"intl:compile": "formatjs compile src/intl/en.json --ast --out-file compiled-lang/en.json"
},
@ -22,10 +24,17 @@
"@types/node": "^15.3.1",
"@types/react": "^17.0.1",
"@types/react-dom": "^17.0.1",
"@typescript-eslint/eslint-plugin": "^4.25.0",
"@typescript-eslint/parser": "^4.25.0",
"eslint": "^7.27.0",
"eslint-config-google": "^0.14.0",
"eslint-plugin-react": "^7.23.2",
"gatsby-cli": "^3.5.0",
"gatsby-plugin-intl": "^0.3.3",
"gatsby-plugin-prettier-eslint": "^1.0.6",
"gatsby-plugin-sass": "^4.5.0",
"gh-pages": "^3.2.0",
"prettier": "^2.3.0",
"sass": "^1.33.0",
"sass-loader": "^11.1.1"
},

View file

@ -1,17 +1,17 @@
import React from 'react';
import { Footer } from '@trussworks/react-uswds';
import {Footer} from '@trussworks/react-uswds';
import {Link} from 'gatsby-plugin-intl';
const footerLinks = [
<Link to="/">Home</Link>
<Link to="/" key="/">Home</Link>,
];
const J40Footer = () => {
return (
<>
<Footer primary={[]} secondary={footerLinks} />
</>
);
return (
<>
<Footer primary={[]} secondary={footerLinks} />
</>
);
};
export default J40Footer;
export default J40Footer;

View file

@ -1,25 +1,27 @@
import React from 'react';
import { GovBanner, Header, Title, PrimaryNav } from '@trussworks/react-uswds';
import { useIntl, Link } from "gatsby-plugin-intl"
import {GovBanner, Header, Title, PrimaryNav} from '@trussworks/react-uswds';
import {useIntl, Link} from 'gatsby-plugin-intl';
const headerLinks = [
<Link to="/">Home</Link>
<Link to="/" key="/">Home</Link>,
];
const J40Header = () => {
const intl = useIntl()
const title = intl.formatMessage({ id: "71L0pp", defaultMessage:"Justice40", description:"Title of the project" });
return (
<>
<GovBanner />
<Header>
<Title>
{title}
</Title>
<PrimaryNav items={headerLinks}/>
</Header>
</>
);
const intl = useIntl();
const title = intl.formatMessage({id: '71L0pp',
defaultMessage: 'Justice40',
description: 'Title of the project'});
return (
<>
<GovBanner />
<Header>
<Title>
{title}
</Title>
<PrimaryNav items={headerLinks}/>
</Header>
</>
);
};
export default J40Header;
export default J40Header;

View file

@ -1,19 +1,19 @@
import React, { ReactNode } from "react";
import React, {ReactNode} from 'react';
import * as styles from './layout.module.scss';
import J40Header from './J40Header';
import J40Footer from "./J40Footer";
import J40Footer from './J40Footer';
interface ILayoutProps {
children: ReactNode
}
const Layout = ({ children }: ILayoutProps) => {
const Layout = ({children}: ILayoutProps) => {
return (
<div className={styles.site}>
<J40Header />
<div className={styles.siteContent}>{children}</div>
<J40Footer />
</div>
<div className={styles.site}>
<J40Header />
<div className={styles.siteContent}>{children}</div>
<J40Footer />
</div>
);
};
export default Layout;
export default Layout;

View file

@ -1,28 +1,28 @@
import * as React from "react";
import { Link } from "gatsby-plugin-intl";
import * as React from 'react';
import {Link} from 'gatsby-plugin-intl';
// styles
const pageStyles = {
color: "#232129",
padding: "96px",
fontFamily: "-apple-system, Roboto, sans-serif, serif",
}
color: '#232129',
padding: '96px',
fontFamily: '-apple-system, Roboto, sans-serif, serif',
};
const headingStyles = {
marginTop: 0,
marginBottom: 64,
maxWidth: 320,
}
};
const paragraphStyles = {
marginBottom: 48,
}
};
const codeStyles = {
color: "#8A6534",
color: '#8A6534',
padding: 4,
backgroundColor: "#FFF4DB",
fontSize: "1.25rem",
backgroundColor: '#FFF4DB',
fontSize: '1.25rem',
borderRadius: 4,
}
};
// markup
const NotFoundPage = () => {
@ -31,13 +31,13 @@ const NotFoundPage = () => {
<title>Not found</title>
<h1 style={headingStyles}>Page not found</h1>
<p style={paragraphStyles}>
Sorry{" "}
Sorry{' '}
<span role="img" aria-label="Pensive emoji">
😔
</span>{" "}
</span>{' '}
we couldnt find what you were looking for.
<br />
{process.env.NODE_ENV === "development" ? (
{process.env.NODE_ENV === 'development' ? (
<>
<br />
Try creating a page in <code style={codeStyles}>src/pages/</code>.
@ -48,7 +48,7 @@ const NotFoundPage = () => {
<Link to="/">Go home</Link>.
</p>
</main>
)
}
);
};
export default NotFoundPage
export default NotFoundPage;

View file

@ -1,15 +1,14 @@
import * as React from "react"
import * as React from 'react';
import Layout from '../components/layout';
// markup
const IndexPage = () => {
return (
<Layout>
<main>
<h2>Subheader</h2>
</main>
</Layout>
)
}
);
};
export default IndexPage;

View file

@ -1,17 +1,17 @@
{
"compilerOptions": {
"module": "commonjs",
"target": "es6",
"jsx": "preserve",
"lib": ["dom", "es2015", "es2017"],
"strict": true,
"noEmit": true,
"isolatedModules": true,
"esModuleInterop": true,
"skipLibCheck": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"removeComments": false
},
"include": ["./src/**/*"]
}
"compilerOptions": {
"module": "commonjs",
"target": "es6",
"jsx": "preserve",
"lib": ["dom", "es2015", "es2017"],
"strict": true,
"noEmit": true,
"isolatedModules": true,
"esModuleInterop": true,
"skipLibCheck": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"removeComments": false
},
"include": ["./src/**/*"]
}