Skip to content
This repository was archived by the owner on Jan 24, 2025. It is now read-only.

Commit 280981f

Browse files
committed
fix: eslint configs
1 parent 16de037 commit 280981f

File tree

48 files changed

+144
-72
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+144
-72
lines changed

.eslintignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
**/dist
1+
**/**/dist/**

.vscode/settings.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
{
22
"typescript.tsdk": "node_modules/typescript/lib",
3+
"javascript.format.enable": false,
34
"eslint.autoFixOnSave": true,
45
"eslint.validate": [
5-
"javascript",
6-
"javascriptreact",
6+
{ "language": "javascript", "autoFix": true },
7+
{ "language": "javascriptreact", "autoFix": true },
78
{ "language": "typescript", "autoFix": true },
89
{ "language": "typescriptreact", "autoFix": true }
910
]

core/docz-core/.eslintignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
dist

core/docz-core/.eslintrc.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
module.exports = {
2-
extends: ['eslint-config-docz'],
2+
extends: 'docz-ts',
33
}

core/docz-core/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@
5656
"@types/shelljs": "^0.8.5",
5757
"@types/signale": "^1.2.1",
5858
"cpy": "^7.3.0",
59-
"docz-rollup": "^1.2.0"
59+
"docz-rollup": "^1.2.0",
60+
"eslint-config-docz-ts": "^1.2.0"
6061
}
6162
}

core/docz-core/src/bundler/config.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,9 @@ import { ServerHooks as Hooks } from '../lib/Bundler'
33

44
import * as paths from '../config/paths'
55

6-
export const createConfig = (args: Args, env: Env) => async (hooks: Hooks) => {
6+
export const createConfig = (args: Args, _env: Env) => async (
7+
_hooks: Hooks
8+
) => {
79
return {
810
gatsbyConfig: {
911
siteMetadata: {

core/docz-core/src/bundler/server.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import { Config as Args } from '../config/argv'
66
import { ServerHooks as Hooks } from '../lib/Bundler'
77
import { devServerMachine } from '../machines/devServer'
88

9-
export const server = (args: Args) => async (config: any, hooks: Hooks) => {
9+
export const server = (args: Args) => async (config: any, _hooks: Hooks) => {
1010
const doczrcFilepath = await findUp(finds('docz'))
1111
const machine = devServerMachine.withContext({
1212
args,

core/docz-core/src/commands/serve.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import sh from 'shelljs'
44

55
import * as paths from '../config/paths'
66

7-
export const serve = async (args: Arguments<any>) => {
7+
export const serve = async (_args: Arguments<any>) => {
88
sh.cd(paths.docz)
99
spawn.sync('yarn', ['serve'], { stdio: 'inherit' })
1010
}

core/docz-rollup/.eslintrc.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
module.exports = {
2-
extends: ['eslint-config-docz'],
2+
extends: 'docz-js',
33
}

core/docz-rollup/package.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,5 +30,8 @@
3030
"rollup-plugin-postcss": "^2.0.3",
3131
"rollup-plugin-progress": "^1.1.1",
3232
"rollup-plugin-typescript2": "^0.21.2"
33+
},
34+
"devDependencies": {
35+
"eslint-config-docz-js": "^1.2.0"
3336
}
3437
}

core/docz-rollup/src/plugins/size.js

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,7 @@ const filesize = require('filesize')
77
const gzip = require('gzip-size')
88
const logUpdate = require('log-update')
99

10-
const cwd = process.cwd()
1110
const label = `${chalk.cyan.bold(figures.arrowRight)}`
12-
1311
const placeholder = text => chalk.gray(`${text}:`)
1412
const getFilesize = file => filesize(fs.statSync(file).size)
1513
const getGzipSize = file => filesize(gzip.sync(fs.readFileSync(file, 'utf-8')))
@@ -19,7 +17,6 @@ module.exports = dest => ({
1917
generateBundle(opts, bundle, isWrite) {
2018
if (!isWrite) return
2119

22-
const destDir = path.join(cwd, dest)
2320
const keys = Object.keys(bundle)
2421
const builds = keys.map(key => bundle[key])
2522

core/docz-utils/.eslintignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
lib

core/docz-utils/.eslintrc.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
module.exports = {
2-
extends: ['eslint-config-docz'],
2+
extends: 'docz-ts',
33
}

core/docz-utils/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@
4444
"unist-util-visit": "^1.4.1"
4545
},
4646
"devDependencies": {
47-
"docz-rollup": "^1.2.0"
47+
"docz-rollup": "^1.2.0",
48+
"eslint-config-docz-ts": "^1.2.0"
4849
}
4950
}

core/docz-utils/src/format.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ export const formatter = (code: string) =>
1010
} as any)
1111

1212
export const format = (code: string): Promise<string> =>
13-
new Promise((resolve, reject) => {
13+
new Promise(resolve => {
1414
try {
1515
const result = formatter(code)
1616

core/docz/.eslintignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
dist

core/docz/.eslintrc.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
module.exports = {
2-
extends: ['eslint-config-docz'],
2+
extends: 'docz-ts',
33
}

core/docz/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,8 @@
4949
"@types/node": "^12.0.10",
5050
"@types/reach__router": "^1.2.4",
5151
"@types/react": "^16.8.22",
52-
"docz-rollup": "^1.2.0"
52+
"docz-rollup": "^1.2.0",
53+
"eslint-config-docz-ts": "^1.2.0"
5354
},
5455
"resolutions": {
5556
"react": "^16.8.6"

core/docz/src/hooks/useWindowSize.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ const getSize = (initialWidth: number, initialHeight: number) => ({
1212

1313
export const useWindowSize = (
1414
throttleMs: number = 300,
15-
initialWidth = Infinity,
15+
_initialWidth = Infinity,
1616
initialHeight = Infinity
1717
) => {
1818
const [windowSize, setWindowSize] = useState(

core/gatsby-theme-docz/.eslintignore

Lines changed: 0 additions & 1 deletion
This file was deleted.

core/gatsby-theme-docz/.eslintrc.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
module.exports = {
2-
extends: ['eslint-config-docz'],
2+
extends: 'docz-js',
33
}

core/gatsby-theme-docz/lib/createPages.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ const ENTRIES_QUERY = `
2323
}
2424
`
2525

26-
module.exports = ({ graphql, actions, ...props }) => {
26+
module.exports = ({ graphql, actions }) => {
2727
return graphql(ENTRIES_QUERY).then(({ data, errors }) => {
2828
const hasErrors = errors && errors.length > 0
2929
const entries = get('allDoczEntries.edges', data)

core/gatsby-theme-docz/lib/sourceNodes.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ module.exports = async ({ actions, createNodeId }, opts) => {
5353
const values = Object.entries(map)
5454
const contentDigest = digest(JSON.stringify(values))
5555

56-
values.forEach(([key, entry]) => {
56+
values.forEach(([, entry]) => {
5757
if (!entry) return null
5858
createNode({
5959
...entry,

core/gatsby-theme-docz/package.json

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -63,11 +63,6 @@
6363
"devDependencies": {
6464
"babel-eslint": "10.0.2",
6565
"eslint": "^5.16.0",
66-
"eslint-config-react-app": "^4.0.1",
67-
"eslint-plugin-flowtype": "3.11.1",
68-
"eslint-plugin-import": "2.18.0",
69-
"eslint-plugin-jsx-a11y": "6.2.1",
70-
"eslint-plugin-react": "7.14.2",
71-
"eslint-plugin-react-hooks": "^1.6.0"
66+
"eslint-config-docz-js": "^1.2.0"
7267
}
7368
}

core/gatsby-theme-docz/src/components/Header/index.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import { Link, useConfig, useCurrentDoc } from 'docz'
44
import styled from '@emotion/styled'
55

66
import { themeProp } from '~utils/theme'
7-
import { breakpoints } from '~theme/breakpoints'
87

98
import { Edit, Sun, Menu, Github } from '../Icons'
109
import * as styles from './styles'

core/rehype-docz/.eslintignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
dist

core/rehype-docz/.eslintrc.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
module.exports = {
2-
extends: ['eslint-config-docz'],
2+
extends: 'docz-ts',
33
}

core/rehype-docz/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
"devDependencies": {
3030
"@mdx-js/mdx": "^1.0.21",
3131
"docz-rollup": "^1.2.0",
32+
"eslint-config-docz-ts": "^1.2.0",
3233
"remark-docz": "^1.2.0"
3334
}
3435
}

core/remark-docz/.eslintignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
dist

core/remark-docz/.eslintrc.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
module.exports = {
2-
extends: ['eslint-config-docz'],
2+
extends: 'docz-ts',
33
}

core/remark-docz/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
},
2828
"devDependencies": {
2929
"@mdx-js/mdx": "^1.0.21",
30-
"docz-rollup": "^1.2.0"
30+
"docz-rollup": "^1.2.0",
31+
"eslint-config-docz-ts": "^1.2.0"
3132
}
3233
}

core/remark-docz/src/index.ts

Lines changed: 9 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -99,21 +99,13 @@ const imageToJsx = (node: any): string =>
9999

100100
// turns `html` nodes into `jsx` nodes
101101
export default () => (tree: any) => {
102-
visit(
103-
tree,
104-
'image',
105-
(node: any, idx: any): void => {
106-
// check if a node has just open tag
107-
node.type = 'jsx'
108-
node.value = imageToJsx(node)
109-
}
110-
)
111-
visit(
112-
tree,
113-
'jsx',
114-
(node: any, idx: any): void => {
115-
// check if a node has just open tag
116-
mergeNodeWithoutCloseTag(tree, node, idx)
117-
}
118-
)
102+
visit(tree, 'image', (node: any): void => {
103+
// check if a node has just open tag
104+
node.type = 'jsx'
105+
node.value = imageToJsx(node)
106+
})
107+
visit(tree, 'jsx', (node: any, idx: any): void => {
108+
// check if a node has just open tag
109+
mergeNodeWithoutCloseTag(tree, node, idx)
110+
})
119111
}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
module.exports = {
2-
extends: ['eslint-config-docz'],
2+
extends: 'docz-js',
33
}

other-packages/babel-plugin-export-metadata/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
"devDependencies": {
3636
"babel-jest": "^24.8.0",
3737
"docz-rollup": "^1.2.0",
38+
"eslint-config-docz-js": "^1.2.0",
3839
"jest": "^24.8.0"
3940
}
4041
}

other-packages/babel-plugin-export-metadata/src/index.js

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -64,13 +64,6 @@ const renameDefaultAddFileMetaProperties = (t, path, filename, name) => {
6464
SOURCE: sourceValue,
6565
})
6666

67-
// insert
68-
const newNode = buildFileMeta({
69-
ID: t.identifier(fallbackName),
70-
NAME: t.stringLiteral(fallbackName),
71-
FILENAME: t.stringLiteral(filename),
72-
})
73-
7467
pathToInsert.replaceWithMultiple(nameExport)
7568
}
7669

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
module.exports = {
2+
parser: 'babel-eslint',
3+
extends: ['plugin:react/recommended', 'plugin:prettier/recommended'],
4+
rules: {
5+
'no-unused-vars': [
6+
'error',
7+
{
8+
vars: 'all',
9+
args: 'after-used',
10+
ignoreRestSiblings: false,
11+
argsIgnorePattern: '^_',
12+
},
13+
],
14+
'comma-dangle': ['error', 'always-multiline'],
15+
'no-mixed-operators': 'error',
16+
'no-console': 'off',
17+
'no-undef': 'off',
18+
'react/prop-types': 'off',
19+
},
20+
parserOptions: {
21+
ecmaVersion: 2018,
22+
sourceType: 'module',
23+
ecmaFeatures: {
24+
jsx: true,
25+
},
26+
},
27+
settings: {
28+
react: {
29+
version: 'detect',
30+
},
31+
},
32+
}
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
{
2+
"name": "eslint-config-docz-js",
3+
"version": "1.2.0",
4+
"description": "Eslint config of Docz for Javascript",
5+
"license": "MIT",
6+
"author": {
7+
"name": "Pedro Nauck",
8+
"email": "[email protected]"
9+
},
10+
"main": "index.js",
11+
"files": [
12+
"index.js",
13+
"package.json"
14+
],
15+
"scripts": {
16+
"fix": "run-s fix:*",
17+
"fix:prettier": "prettier \"src/**/*.js\" --write"
18+
},
19+
"dependencies": {
20+
"babel-eslint": "^10.0.2",
21+
"eslint": "^5.16.0",
22+
"eslint-config-prettier": "^5.0.0",
23+
"eslint-plugin-prettier": "^3.1.0",
24+
"eslint-plugin-react": "^7.13.0"
25+
}
26+
}
Lines changed: 16 additions & 0 deletions

other-packages/eslint-plugin-docz/src/index.js renamed to other-packages/eslint-config-docz-ts/index.js

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,15 @@ module.exports = {
1212
'no-console': 'off',
1313
'no-undef': 'off',
1414
'react/prop-types': 'off',
15-
'@typescript-eslint/no-unused-vars': 'off',
15+
'@typescript-eslint/no-unused-vars': [
16+
'error',
17+
{
18+
vars: 'all',
19+
args: 'after-used',
20+
ignoreRestSiblings: false,
21+
argsIgnorePattern: '^_',
22+
},
23+
],
1624
'@typescript-eslint/indent': 'off',
1725
'@typescript-eslint/no-explicit-any': 'off',
1826
'@typescript-eslint/no-non-null-assertion': 'off',

other-packages/eslint-plugin-docz/package.json renamed to other-packages/eslint-config-docz-ts/package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
{
2-
"name": "eslint-config-docz",
2+
"name": "eslint-config-docz-ts",
33
"version": "1.2.0",
4-
"description": "Eslint config of Docz",
4+
"description": "Eslint config of Docz for Typescript",
55
"license": "MIT",
66
"author": {
77
"name": "Pedro Nauck",
88
"email": "[email protected]"
99
},
10-
"main": "src/index.js",
10+
"main": "index.js",
1111
"files": [
12-
"src/",
12+
"index.js",
1313
"package.json"
1414
],
1515
"scripts": {

other-packages/load-cfg/.eslintignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
dist

other-packages/load-cfg/.eslintrc.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
module.exports = {
2-
extends: ['eslint-config-docz'],
2+
extends: 'docz-ts',
33
}

0 commit comments

Comments
 (0)