Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ESLint and pin next peer dependency range #21

Merged
merged 26 commits into from
Jun 7, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
1b3293e
chore: 🤖 install jest eslint and draft testing strategy plan
May 21, 2021
3d976f0
chore: 🤖 add eslint npm script
May 21, 2021
c036c3d
test: 💍 add unit tests and refactor file structure
May 24, 2021
f392c1d
chore: 🤖 rename import
May 24, 2021
1fef475
test: 💍 add test for start watcher
May 24, 2021
ac60ebe
test: 💍 add test for watcher
May 24, 2021
d1d3423
chore: 🤖 add nextjs as peer dependency
May 24, 2021
e3bf8c0
refactor: 💡 better code encapsulation and naming
May 24, 2021
08a30fa
refactor: 💡 better naming for files
May 24, 2021
987372e
refactor: 💡 more file name and import change for better clarity
May 24, 2021
5825452
chore: 🤖 removed eslint comment
May 24, 2021
4a4e411
chore: 🤖 remove from git testing plan
May 24, 2021
5dd97fa
chore: 🤖 fix import
May 24, 2021
673a408
chore: 🤖 eslint plugin import
May 24, 2021
40fcdba
test: 💍 test coverage and refactor for express server
May 25, 2021
f80b875
chore: 🤖 eslint group imports
May 25, 2021
9e59b22
refactor: 💡 change import style for better clarity
May 25, 2021
171253f
chore: 🤖 function renaming
May 25, 2021
065bac7
refactor: 💡 create router within scope of express start functio
May 25, 2021
370d0e5
refactor: 💡 migrate to arrow function
May 25, 2021
812b251
chore: 🤖 eslint import fix
May 25, 2021
70f296a
docs: ✏️ add comment for deprecated api
May 25, 2021
27f1252
chore: 🤖 semver support for next 10
May 25, 2021
c19829f
refactor: 💡 change test to use jest utils
May 25, 2021
dfa3087
Update src/main.js
floroz May 28, 2021
fcfeb1f
feat: restore project structure and expand linting config
floroz Jun 7, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
.next
node_modules
44 changes: 44 additions & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
{
"extends": ["eslint:recommended", "plugin:import/recommended", "prettier"],
"plugins": ["import"],
"env": {
"node": true,
"jest": true,
"browser": true
},
"parserOptions": {
"ecmaFeatures": {
"jsx": true
}
},
"settings": {
"import/extensions": [".js", ".jsx"]
},
"rules": {
"import/order": [
"error",
{
"newlines-between": "always",
"alphabetize": { "order": "asc" },
"groups": [["builtin", "external"], "sibling", "parent"]
}
],
"import/no-unresolved": [2, { "commonjs": true }]
},
"overrides": [
{
"files": ["bin/*"],
"extends": [
"eslint:recommended",
"plugin:node/recommended",
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we create an override here to avoid applying the node settings and plugin to the rest of the project (which may include browser environments and next.js files)

"plugin:import/recommended",
"prettier"
],
"plugins": ["import", "node"],
"env": {
"node": true,
"jest": true
}
}
]
}
14 changes: 8 additions & 6 deletions bin/next-remote-watch
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
#!/usr/bin/env node

const program = require('commander')
const pkg = require('../package.json')
const express = require('express')
const bodyParser = require('body-parser')
const chalk = require('chalk')
const { parse } = require('url')
const chokidar = require('chokidar')
const program = require('commander')
const express = require('express')
const next = require('next')
const path = require('path')
// TODO: parse is deprecated in favour of new URL api
// eslint-disable-next-line node/no-deprecated-api
const { parse } = require('url')

const pkg = require('../package.json')

const defaultWatchEvent = 'change'

Expand Down Expand Up @@ -76,7 +78,7 @@ app.prepare().then(() => {

// special handling for mdx reload route
const reloadRoute = express.Router()
reloadRoute.use(bodyParser.json())
reloadRoute.use(express.json())
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

bodyparser is now baked in express

reloadRoute.all('/', (req, res) => {
// log message if present
const msg = req.body.message
Expand Down
Loading