chore: lint from root for frontend deps

Luke Karrys committed Oct 15, 2023 at 10:43 UTC ff79d0dc498b39635a35c93c0b63f4352c628d16
14 files changed +51 -115
.gitignore
+1
@@ -12,6 +12,7 @@
12 !/.gitignore
13 !/.npmrc
14 !/.nvmrc
15 +!/.prettierIgnore
16 !/.release-please-manifest.json
17 !/.reuse/
18 !/*.md
.prettierIgnore new
+10
@@ -0,0 +1,10 @@
1 +**/template-oss/*.json
2 +**/template-oss/*.yml
3 +content/
4 +content-debug/
5 +cli/
6 +.github/
7 +package-lock.json
8 +CODE_OF_CONDUCT.md
9 +CONTENT-MODEL.md
10 +SECURITY.md
cli/package.json
+3 -12
@@ -13,8 +13,9 @@
13 "template-oss-apply": "template-oss-apply --force",
14 "lintfix": "npm run lint -- --fix",
15 "snap": "tap",
16 - "test": "tap",
17 - "posttest": "npm run lint"
16 + "test": "jest",
17 + "posttest": "npm run lint",
18 + "format": "prettier --write ."
19 },
20 "dependencies": {
21 "@octokit/rest": "^20.0.2",
@@ -33,10 +34,6 @@
34 "tap": "^16.3.9"
35 },
36 "author": "GitHub Inc.",
36 - "files": [
37 - "bin/",
38 - "lib/"
39 - ],
37 "engines": {
38 "node": ">=18.0.0"
39 },
@@ -44,11 +41,5 @@
41 "//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.",
42 "version": "4.19.0",
43 "content": "./scripts/template-oss"
47 - },
48 - "tap": {
49 - "nyc-arg": [
50 - "--exclude",
51 - "tap-snapshots/**"
52 - ]
44 }
45 }
package.json
+3 -17
@@ -17,10 +17,11 @@
17 "template-oss-apply": "template-oss-apply --force",
18 "lintfix": "npm run lint -- --fix",
19 "snap": "tap",
20 - "test": "tap",
20 + "test": "jest",
21 "posttest": "npm run lint",
22 "test-all": "npm run test -ws -iwr --if-present",
23 - "lint-all": "npm run lint -ws -iwr --if-present"
23 + "lint-all": "npm run lint -ws -iwr --if-present",
24 + "format": "prettier --write ."
25 },
26 "workspaces": [
27 "cli/",
@@ -45,10 +46,6 @@
46 "tap": "^16.3.9"
47 },
48 "author": "GitHub Inc.",
48 - "files": [
49 - "bin/",
50 - "lib/"
51 - ],
49 "engines": {
50 "node": ">=18.0.0"
51 },
@@ -57,17 +54,6 @@
54 "version": "4.19.0",
55 "content": "./scripts/template-oss"
56 },
60 - "tap": {
61 - "test-ignore": "^(cli|theme)/",
62 - "nyc-arg": [
63 - "--exclude",
64 - "cli/**",
65 - "--exclude",
66 - "theme/**",
67 - "--exclude",
68 - "tap-snapshots/**"
69 - ]
70 - },
57 "eslintIgnore": [
58 ".cache/",
59 "public/"
scripts/template-oss/index.js
+11
@@ -11,6 +11,7 @@ module.exports = {
11 },
12 rootModule: {
13 add: {
14 + 'package.json': { file: 'pkg.json', overwrite: false },
15 '.eslintrc.js': false,
16 'CODE_OF_CONDUCT.md': false,
17 'CONTRIBUTING.md': false,
@@ -21,12 +22,21 @@ module.exports = {
22 '.github/settings.yml': false,
23 },
24 },
25 + workspaceModule: {
26 + add: {
27 + 'package.json': { file: 'pkg.json', overwrite: false },
28 + '.eslintrc.js': false,
29 + },
30 + },
31 ciVersions: 'latest',
32 latestCiVersion: 18,
33 macCI: false,
34 windowsCI: false,
35 lockfile: true,
36 allowedPackages: ['eslint'],
37 + requiredPackages: {
38 + devDependencies: []
39 + },
40 allowPaths: [
41 '/.reuse/',
42 '/src/',
@@ -38,5 +48,6 @@ module.exports = {
48 '/CONTRIBUTING.md',
49 '/CONTENT-MODEL.md',
50 '/.nvmrc',
51 + '/.prettierIgnore',
52 ],
53 }
scripts/template-oss/pkg.json renamed
+2 -1
@@ -3,5 +3,6 @@
3 "test": "jest",
4 "format": "prettier --write ."
5 },
6 - "files": {{{ del }}}
6 + "files": {{{ del }}},
7 + "tap": {{{ del }}}
8 }
theme/.eslintrc.js deleted
-43
@@ -1,43 +0,0 @@
1 -module.exports = {
2 - root: true,
3 - parserOptions: {
4 - ecmaFeatures: {
5 - jsx: true,
6 - },
7 - },
8 - env: {
9 - commonjs: true,
10 - es2022: true,
11 - browser: true,
12 - },
13 - extends: [
14 - '@npmcli',
15 - 'eslint:recommended',
16 - 'plugin:react/recommended',
17 - 'plugin:github/react',
18 - 'plugin:primer-react/recommended',
19 - 'prettier',
20 - 'plugin:react-hooks/recommended',
21 - ],
22 - settings: {
23 - react: {
24 - version: 'detect',
25 - },
26 - },
27 - rules: {
28 - 'max-len': 'off',
29 - 'react/prop-types': 'off',
30 - // TODO: migrate primer/react components to sx instead of deprecated system props
31 - 'primer-react/no-system-props': ['warn', {includeUtilityComponents: true}],
32 - },
33 - overrides: [
34 - {
35 - files: ['gatsby-node.js', 'gatsby-config.js'],
36 - env: {node: true, browser: false},
37 - },
38 - {
39 - files: ['test/*', './src/**/__tests__/*'],
40 - env: {jest: true},
41 - },
42 - ],
43 -}
theme/.gitignore
-1
@@ -8,7 +8,6 @@
8 !/.eslintrc.js
9 !/.eslintrc.local.*
10 !/.gitignore
11 -!/.prettierIgnore
11 !/bin/
12 !/CHANGELOG*
13 !/docs/
theme/.prettierIgnore deleted
-2
@@ -1,2 +0,0 @@
1 -scripts/template-oss/*.json
2 -scripts/template-oss/*.yml
theme/package.json
+1 -20
@@ -53,20 +53,7 @@
53 "styled-components": "^5.3.11"
54 },
55 "devDependencies": {
56 - "@github/prettier-config": "^0.0.6",
57 - "@npmcli/template-oss": "4.19.0",
58 - "@testing-library/jest-dom": "^6.1.4",
59 - "@testing-library/react": "^9.5.0",
60 - "babel-jest": "^29.7.0",
61 - "eslint": "^8.51.0",
62 - "eslint-plugin-github": "^4.10.1",
63 - "eslint-plugin-jsx-a11y": "^6.7.1",
64 - "eslint-plugin-primer-react": "^4.0.3",
65 - "eslint-plugin-react": "^7.33.2",
66 - "eslint-plugin-react-hooks": "^4.6.0",
67 - "jest": "^29.7.0",
68 - "jest-environment-jsdom": "^29.7.0",
69 - "prettier": "^3.0.3"
56 + "@npmcli/template-oss": "4.19.0"
57 },
58 "author": "GitHub Inc.",
59 "engines": {
@@ -76,11 +63,5 @@
63 "//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.",
64 "version": "4.19.0",
65 "content": "./scripts/template-oss"
79 - },
80 - "tap": {
81 - "nyc-arg": [
82 - "--exclude",
83 - "tap-snapshots/**"
84 - ]
66 }
67 }
theme/scripts/template-oss/_step-deps.yml deleted
-2
@@ -1,2 +0,0 @@
1 -- name: Install Dependencies
2 - run: {{ rootNpmPath }} i --no-audit --no-fund {{~#if jobDepFlags}} {{ jobDepFlags }}{{/if}}
theme/scripts/template-oss/index.js
-14
@@ -1,18 +1,4 @@
1 module.exports = {
2 ...require('../../../scripts/template-oss'),
3 - workspaceRepo: {
4 - add: {
5 - '.github/settings.yml': false,
6 - },
7 - },
8 - workspaceModule: {
9 - add: {
10 - 'package.json': {file: 'pkg.json', overwrite: false},
11 - '.eslintrc.js': false,
12 - },
13 - },
3 allowPaths: ['/src', '/gatsby-*.js', '/jest*.js', '/index.js', '/.prettierIgnore'],
15 - requiredPackages: {
16 - devDependencies: [],
17 - },
4 }
theme/src/components/hero.js
+16 -1
@@ -1,11 +1,26 @@
1 import React from 'react'
2 -import {Box, Heading, Text} from '@primer/react'
2 +import {Box, Heading, Text, ThemeProvider} from '@primer/react'
3 import useSiteMetadata from '../hooks/use-site-metadata'
4 import Container from './container'
5
6 function Hero() {
7 const {title, description} = useSiteMetadata()
8
9 + return (
10 + <ThemeProvider colorMode="night" nightScheme="dark_dimmed">
11 + <Box sx={{bg: 'canvas.default', py: 6}}>
12 + <Container>
13 + <Heading as="h1" sx={{color: 'accent.fg', fontSize: 7, m: 0}}>
14 + {title}
15 + </Heading>
16 + <Text as="p" sx={{m: 0, color: 'fg.onEmphasis', fontSize: 4}}>
17 + {description}
18 + </Text>
19 + </Container>
20 + </Box>
21 + </ThemeProvider>
22 + )
23 +
24 return (
25 <Box bg="black" py={6}>
26 <Container>
theme/src/root-element.js
+4 -2
@@ -1,6 +1,6 @@
1 import React from 'react'
2 import {MDXProvider} from '@mdx-js/react'
3 -import {Link, theme, SSRProvider, ThemeProvider} from '@primer/react'
3 +import {Link, SSRProvider, ThemeProvider, theme} from '@primer/react'
4 import Blockquote from './mdx/blockquote'
5 import Code from './mdx/code'
6 import DescriptionList from './mdx/description-list'
@@ -21,6 +21,8 @@ function UnderlinedLink(props) {
21 return <Link {...props} underline={true} />
22 }
23
24 +console.log(theme)
25 +
26 const components = {
27 a: UnderlinedLink,
28 pre: props => props.children,
@@ -52,7 +54,7 @@ function RootElement({element}) {
54 return (
55 <SSRProvider>
56 <MDXProvider components={components}>
55 - <ThemeProvider theme={theme}>{element}</ThemeProvider>
57 + <ThemeProvider>{element}</ThemeProvider>
58 </MDXProvider>
59 </SSRProvider>
60 )