Skip to content

Commit ebfec8a

Browse files
XhmikosRascorbic
andauthored
chore: update linting (#223)
* chore(deps): remove unneeded devDependencies * chore(deps): remove unneeded devDependencies * chore: update rules * chore: remove extraneous fixture * chore: lint fixes * chore: prettier * chore: lint * fix: update jest config * fix: run build from cli Co-authored-by: Matt Kane <[email protected]>
1 parent 48f41ce commit ebfec8a

Some content is hidden

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

66 files changed

+22824
-14440
lines changed

.eslintignore

+22-1
Original file line numberDiff line numberDiff line change
@@ -1 +1,22 @@
1-
plugin/lib
1+
plugin/lib
2+
.netlify
3+
fixtures/
4+
demo
5+
6+
*~
7+
*.swp
8+
npm-debug.log
9+
node_modules
10+
/core
11+
.eslintcache
12+
.yarn-error.log
13+
.nyc_output
14+
!.github/
15+
/coverage
16+
/build
17+
.netlify
18+
/yarn.lock
19+
.cache
20+
public
21+
.DS_Store
22+
.parcel-cache

.eslintrc.js

+31-32
Original file line numberDiff line numberDiff line change
@@ -2,44 +2,43 @@ const { overrides } = require('@netlify/eslint-config-node')
22

33
module.exports = {
44
extends: '@netlify/eslint-config-node',
5-
// TODO: remove after https://github.com/netlify/eslint-config-node/pull/230 is merged and released
65
rules: {
7-
'node/no-unsupported-features/es-syntax': [
8-
'error',
9-
{
10-
ignores: ['modules'],
11-
},
12-
],
13-
'func-style': ['error', 'declaration'],
14-
'import/no-dynamic-require': 'off',
6+
// For now
7+
'func-style': 'off',
8+
// This is compiled, so we can use modern syntax
9+
'node/no-unsupported-features/es-syntax': 'off',
10+
// This is a duplicate of `import/no-duplicates` but can handle "import type"
11+
'no-duplicate-imports': 'off',
12+
},
13+
env: {
14+
jest: true,
15+
},
16+
parserOptions: {
17+
sourceType: 'module',
1518
},
1619
overrides: [
1720
...overrides,
18-
// TODO: remove after https://github.com/netlify/eslint-config-node/pull/230 is merged and released
1921
{
20-
files: ['*.ts'],
21-
extends: [
22-
'plugin:@typescript-eslint/eslint-recommended',
23-
'plugin:@typescript-eslint/recommended',
24-
'plugin:import/typescript',
25-
],
26-
},
27-
],
28-
settings: {
29-
// TODO: remove after https://github.com/netlify/eslint-config-node/pull/230 is merged and released
30-
'import/parsers': {
31-
'@typescript-eslint/parser': ['.ts', '.tsx'],
32-
},
33-
'import/resolver': {
34-
node: {
35-
extensions: ['.js', '.jsx', '.d.ts', '.ts', '.tsx'],
36-
},
37-
typescript: {
38-
alwaysTryTypes: true,
22+
// Tests use lots of nested callbacks
23+
files: ['*-test.js', '*.spec.js', '**/e2e-tests/*.js'],
24+
rules: {
25+
'max-nested-callbacks': 'off',
3926
},
4027
},
41-
node: {
42-
tryExtensions: ['.js', '.ts', '.d.ts'],
28+
{
29+
// Templates import files from the site itself and needs lots of dynamic requires
30+
files: ['plugin/src/templates/**/*'],
31+
rules: {
32+
'node/no-unpublished-import': 'off',
33+
'@typescript-eslint/no-var-requires': 'off',
34+
'node/global-require': 'off',
35+
'import/no-dynamic-require': 'off',
36+
'import/no-unresolved': 'off',
37+
'node/no-unpublished-require': 'off',
38+
'node/no-missing-require': 'off',
39+
'max-lines': 'off',
40+
'unicorn/filename-case': 'off',
41+
},
4342
},
44-
},
43+
],
4544
}

.prettierignore

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
plugin/lib
2+
.netlify
3+
*~
4+
*.swp
5+
npm-debug.log
6+
node_modules
7+
/core
8+
.eslintcache
9+
.yarn-error.log
10+
.nyc_output
11+
!.github/
12+
/coverage
13+
/build
14+
.netlify
15+
/yarn.lock
16+
.cache
17+
public
18+
.DS_Store
19+
.parcel-cache
20+
node_modules

ava.config.js

-4
This file was deleted.

demo/README.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@
4949

5050
## 🚀 Quick start (Gatsby Cloud)
5151

52-
Deploy this starter with one click on [Gatsby Cloud](https://www.gatsbyjs.com/cloud/):
52+
Deploy this starter with one click on
53+
[Gatsby Cloud](https://www.gatsbyjs.com/cloud/):
5354

5455
[<img src="https://www.gatsbyjs.com/deploynow.svg" alt="Deploy to Gatsby Cloud">](https://www.gatsbyjs.com/dashboard/deploynow?url=https://github.com/gatsbyjs/gatsby-starter-minimal)

demo/content/posts/hello-world/index.md

+9-7
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
title: Hello World
3-
date: "2015-05-01T22:12:03.284Z"
4-
description: "Hello World"
3+
date: '2015-05-01T22:12:03.284Z'
4+
description: 'Hello World'
55
---
66

77
This is my first post on my new fake blog! How exciting!
@@ -24,7 +24,7 @@ Oh, and here's a great quote from this Wikipedia on
2424
You can also write code blocks here!
2525

2626
```js
27-
const saltyDuckEgg = "chinese preserved food product"
27+
const saltyDuckEgg = 'chinese preserved food product'
2828
```
2929

3030
| Number | Title | Year |
@@ -87,7 +87,9 @@ This is a paragraph.
8787
##### Header 5 #####
8888
###### Header 6 ######
8989

90-
> Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aliquam hendrerit mi posuere lectus. Vestibulum enim wisi, viverra nec, fringilla in, laoreet vitae, risus.
90+
> Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aliquam hendrerit mi
91+
> posuere lectus. Vestibulum enim wisi, viverra nec, fringilla in, laoreet
92+
> vitae, risus.
9193
9294
> Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aliquam hendrerit mi posuere lectus. Vestibulum enim wisi, viverra nec, fringilla in, laoreet vitae, risus.
9395

@@ -190,13 +192,13 @@ Paragraph:
190192

191193
---------------------------------------
192194

193-
This is [an example](http://example.com "Example") link.
195+
This is [an example](http://example.com 'Example') link.
194196

195197
[This link](http://example.com) has no title attr.
196198

197199
This is [an example][id] reference-style link.
198200

199-
[id]: http://example.com "Optional Title"
201+
[id]: http://example.com 'Optional Title'
200202

201203
This is [an example](http://example.com "Example") link.
202204

@@ -226,6 +228,6 @@ This paragraph has some `code` in it.
226228

227229
This paragraph has some `code` in it.
228230

229-
![Alt Text](https://placehold.it/200x50 "Image Title")
231+
![Alt Text](https://placehold.it/200x50 'Image Title')
230232

231233
![Alt Text](https://placehold.it/200x50 "Image Title")

demo/content/posts/my-second-post/index.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
title: My Second Post!
3-
date: "2015-05-06T23:46:37.121Z"
3+
date: '2015-05-06T23:46:37.121Z'
44
---
55

66
Wow! I love blogging so much already.

demo/content/posts/new-beginnings/index.md

+4-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
---
22
title: New Beginnings
3-
date: "2015-05-28T22:40:32.169Z"
4-
description: This is a custom description for SEO and Open Graph purposes, rather than the default generated excerpt. Simply add a description field to the frontmatter.
3+
date: '2015-05-28T22:40:32.169Z'
4+
description:
5+
This is a custom description for SEO and Open Graph purposes, rather than the
6+
default generated excerpt. Simply add a description field to the frontmatter.
57
---
68

79
Far far away, behind the word mountains, far from the countries Vokalia and

demo/gatsby-node.js

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
const path = require('path')
2+
23
const slugify = require('@sindresorhus/slugify')
34

45
exports.createSchemaCustomization = function createSchemaCustomization({

0 commit comments

Comments
 (0)