Skip to content

Commit

Permalink
add base configs and typescript
Browse files Browse the repository at this point in the history
  • Loading branch information
narr committed Apr 2, 2020
1 parent 52a2811 commit a3c0307
Show file tree
Hide file tree
Showing 19 changed files with 1,577 additions and 1,945 deletions.
19 changes: 19 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# http://editorconfig.org
root = true

[*]
charset = utf-8
end_of_line = lf
indent_size = 2
indent_style = space
insert_final_newline = true
max_line_length = 80
trim_trailing_whitespace = true

[*.md]
max_line_length = 0
trim_trailing_whitespace = false

[COMMIT_EDITMSG]
# Don't wrap lines for Git commit messages
max_line_length = 0
6 changes: 6 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
tmp

build
out

docs
50 changes: 50 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
module.exports = {
extends: [
'eslint:recommended',
'plugin:react/recommended',
'plugin:@typescript-eslint/eslint-recommended',
'plugin:@typescript-eslint/recommended',
'plugin:prettier/recommended',
'prettier/@typescript-eslint',
],
plugins: ['react-hooks'],
env: {
browser: true,
node: true,
},
globals: {
jest: true,
},
parser: '@typescript-eslint/parser',
parserOptions: {
ecmaVersion: 2018,
sourceType: 'module',
},
settings: {
react: {
// Tells eslint-plugin-react to automatically detect the version of React to use
version: 'detect',
},
},
rules: {
'max-lines': [
'error',
{ max: 400, skipComments: true, skipBlankLines: true },
],
'no-console': 'error',
'no-param-reassign': 'error',
'no-var': 'error',
'prefer-const': 'error',
'react/no-unescaped-entities': 'warn',
'react/prop-types': 'off',
'react-hooks/exhaustive-deps': 'warn',
'react-hooks/rules-of-hooks': 'error',
'@typescript-eslint/explicit-function-return-type': 'off',
'@typescript-eslint/no-unused-vars': [
'error',
{ ignoreRestSiblings: true },
],
'@typescript-eslint/no-use-before-define': ['error', 'nofunc'],
'@typescript-eslint/no-var-requires': 'off',
},
};
2 changes: 2 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Auto detect text files and perform LF normalization
* text=auto eol=lf
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
.pnp.js

# testing
.nyc_output
/coverage

# next.js
Expand All @@ -19,6 +20,7 @@
.DS_Store
.env*
tmp
docs

# debug
npm-debug.log*
Expand Down
24 changes: 24 additions & 0 deletions .prettierrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
module.exports = {
arrowParens: 'avoid', // Include parentheses around a sole arrow function parameter.
bracketSpacing: true, // Print spaces between brackets in object literals.
/**
* Do not print spaces between brackets.
* If true, puts the > of a multi-line jsx element at the end of the last line instead of being
* alone on the next line
*/
jsxBracketSameLine: false,
printWidth: 80, // Specify the length of line that the printer will wrap on.
semi: true, // Print semicolons at the ends of statements.
singleQuote: true, // Use single quotes instead of double quotes.
tabWidth: 2, // Specify the number of spaces per indentation-level.
/**
* Print trailing commas wherever possible.
* Valid options:
* - none - no trailing commas
* - es5 - trailing commas where valid in ES5 (objects, arrays, etc)
* - all - trailing commas wherever possible (function arguments)
*/
trailingComma: 'es5',
useTabs: false, // Indent lines with tabs instead of spaces.
endOfLine: 'lf',
};
39 changes: 39 additions & 0 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
{
// See http://go.microsoft.com/fwlink/?LinkId=827846 to learn about workspace recommendations.
// Extension identifier format: ${publisher}.${name}. Example: vscode.csharp
// List of extensions which should be recommended for users of this workspace.
"recommendations": [
"formulahendry.auto-close-tag",
"formulahendry.auto-rename-tag",
"alefragnani.bookmarks",
"coenraads.bracket-pair-colorizer",
"formulahendry.code-runner",
"streetsidesoftware.code-spell-checker",
"editorconfig.editorconfig",
"dbaeumer.vscode-eslint",
"donjayamanne.githistory",
"eamodio.gitlens",
"mkaufman.htmlhint",
"ms-vsliveshare.vsliveshare",
"xyz.local-history",
"davidanson.vscode-markdownlint",
"silvenon.mdx",
"eg2.vscode-npm-script",
"christian-kohler.npm-intellisense",
"techer.open-in-browser",
"christian-kohler.path-intellisense",
"pnp.polacode",
"esbenp.prettier-vscode",
"wallabyjs.quokka-vscode",
"chrmarti.regex",
"humao.rest-client",
"shinnn.stylelint",
"jock.svg",
"wayou.vscode-todo-highlight",
"chakrounanas.turbo-console-log",
"pflannery.vscode-versionlens",
"deerawan.vscode-faker"
],
// List of extensions recommended by VS Code that should not be recommended for users of this workspace.
"unwantedRecommendations": []
}
22 changes: 22 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "Next Build",
"type": "node",
"request": "launch",
"protocol": "inspector",
"program": "${workspaceRoot}/node_modules/next/dist/bin/next",
"args": ["build"],
"stopOnEntry": true,
// https://code.visualstudio.com/docs/nodejs/nodejs-debugging#_breakpoint-validation
"runtimeArgs": ["--nolazy"],
"sourceMaps": false,
// show console.log
"outputCapture": "std"
}
]
}
13 changes: 13 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"files.eol": "\n",
"todohighlight.keywords": [
{
"text": "NOTE:",
"color": "#ddd",
"backgroundColor": "green"
}
],
"turboConsoleLog.quote": "'",
"turboConsoleLog.addSemicolonInTheEnd": true,
"typescript.tsdk": "node_modules\\typescript\\lib"
}
13 changes: 9 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,23 @@
This is a [Next.js](https://nextjs.org/) project bootstrapped with [`create-next-app`](https://github.com/zeit/next.js/tree/canary/packages/create-next-app).
<p align="center">
<a href="https://nextjs.org/">
<img src="https://assets.zeit.co/image/upload/v1538361091/repositories/next-js/next-js.png" alt="Next.js Logo">
</a>
</p>
<h1 align="center">
Narr's Next.js starter
</h1>

## Getting Started

First, run the development server:

```bash
npm run dev
# or
yarn dev
```

Open [http://localhost:3000](http://localhost:3000) with your browser to see the result.

You can start editing the page by modifying `pages/index.js`. The page auto-updates as you edit the file.
You can start editing the page by modifying `src/pages/index.js`. The page auto-updates as you edit the file.

## Learn More

Expand Down
2 changes: 2 additions & 0 deletions next-env.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
/// <reference types="next" />
/// <reference types="next/types/global" />
Loading

0 comments on commit a3c0307

Please sign in to comment.