Skip to content

Commit a122fd2

Browse files
authored
Merge pull request #63 from imranbarbhuiya/master
Rewrite in typescript
2 parents fb49e65 + 16a175d commit a122fd2

File tree

19 files changed

+1772
-12681
lines changed

19 files changed

+1772
-12681
lines changed

.babelrc

Lines changed: 0 additions & 4 deletions
This file was deleted.

.eslintrc.json

Lines changed: 20 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -1,66 +1,31 @@
11
{
2-
"env": {
3-
"node": true,
4-
"commonjs": true,
5-
"es6": true
6-
},
7-
"parser": "@babel/eslint-parser",
8-
"parserOptions": {
9-
"sourceType": "module",
10-
"allowImportExportEverywhere": true
11-
},
2+
"plugins": ["@typescript-eslint"],
3+
"extends": [
4+
"eslint:recommended",
5+
"plugin:@typescript-eslint/eslint-recommended",
6+
"plugin:@typescript-eslint/recommended"
7+
],
128
"rules": {
13-
"arrow-spacing": ["warn", { "before": true, "after": true }],
9+
"quotes": ["error", "single"],
10+
"semi": ["error", "always"],
11+
"eol-last": ["error", "always"],
1412
"comma-dangle": [
1513
"error",
1614
{
1715
"arrays": "always-multiline",
1816
"objects": "always-multiline",
19-
"imports": "never",
20-
"exports": "never",
17+
"imports": "always-multiline",
18+
"exports": "always-multiline",
2119
"functions": "never"
2220
}
2321
],
24-
"comma-spacing": "error",
25-
"comma-style": "error",
26-
"curly": ["error", "multi-line", "consistent"],
27-
"dot-location": ["error", "property"],
28-
"handle-callback-err": "off",
29-
"indent": ["error", 2],
30-
"keyword-spacing": "error",
31-
"max-nested-callbacks": ["error", { "max": 4 }],
32-
"max-statements-per-line": ["error", { "max": 2 }],
33-
"no-console": "off",
34-
"no-empty-function": "error",
35-
"no-floating-decimal": "error",
36-
"no-inline-comments": "error",
37-
"no-lonely-if": "error",
38-
"no-multi-spaces": "error",
39-
"no-multiple-empty-lines": [
40-
"error",
41-
{ "max": 2, "maxEOF": 1, "maxBOF": 0 }
42-
],
43-
"no-shadow": ["error", { "allow": ["err", "resolve", "reject"] }],
44-
"no-trailing-spaces": ["error"],
45-
"no-var": "error",
46-
"object-curly-spacing": ["error", "always"],
47-
"prefer-const": "error",
48-
"quotes": ["error", "double"],
49-
"semi": ["error", "always"],
50-
"space-before-blocks": "error",
51-
"space-before-function-paren": [
52-
"error",
53-
{
54-
"anonymous": "never",
55-
"named": "never",
56-
"asyncArrow": "always"
57-
}
58-
],
59-
"space-in-parens": "error",
60-
"space-infix-ops": "error",
61-
"space-unary-ops": "error",
62-
"spaced-comment": "error",
63-
"yoda": "error"
64-
},
65-
"extends": "prettier"
22+
"arrow-parens": ["error", "always"],
23+
"no-trailing-spaces": ["error", { "skipBlankLines": true }],
24+
"prefer-const": "warn",
25+
"accessor-pairs": "off",
26+
"no-async-promise-executor": "off",
27+
"no-unused-vars": "off",
28+
"node/no-missing-require": "off",
29+
"no-console": "warn"
30+
}
6631
}

.github/workflows/build.yml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# This workflow will do a clean install of node dependencies, cache/restore them, build the source code and run tests across different versions of node
2+
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions
3+
4+
name: Build
5+
6+
on:
7+
push:
8+
branches: [master]
9+
pull_request:
10+
branches: [master]
11+
12+
jobs:
13+
build:
14+
runs-on: ubuntu-latest
15+
16+
strategy:
17+
matrix:
18+
node-version: [16.x, 17.x]
19+
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/
20+
21+
steps:
22+
- uses: actions/checkout@v2
23+
- name: Use Node.js ${{ matrix.node-version }}
24+
uses: actions/setup-node@v2
25+
with:
26+
node-version: ${{ matrix.node-version }}
27+
cache: 'yarn'
28+
cache-dependency-path: yarn.lock
29+
- run: yarn install --frozen-lockfile
30+
- run: yarn build

.github/workflows/lint.yml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# This workflow will do a clean install of node dependencies, cache/restore them, build the source code and run tests across different versions of node
2+
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions
3+
4+
name: Lint
5+
6+
on:
7+
push:
8+
branches: [master]
9+
pull_request:
10+
branches: [master]
11+
12+
jobs:
13+
build:
14+
runs-on: ubuntu-latest
15+
16+
strategy:
17+
matrix:
18+
node-version: [16.x]
19+
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/
20+
21+
steps:
22+
- uses: actions/checkout@v2
23+
- name: Use Node.js ${{ matrix.node-version }}
24+
uses: actions/setup-node@v2
25+
with:
26+
node-version: ${{ matrix.node-version }}
27+
cache: 'yarn'
28+
cache-dependency-path: yarn.lock
29+
- run: yarn install --frozen-lockfile
30+
- run: yarn lint

.gitignore

Lines changed: 0 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -1,46 +1,3 @@
1-
# Logs
2-
logs
3-
*.log
4-
npm-debug.log*
5-
yarn-debug.log*
6-
yarn-error.log*
7-
8-
# Runtime data
9-
pids
10-
*.pid
11-
*.seed
12-
*.pid.lock
13-
14-
# Directory for instrumented libs generated by jscoverage/JSCover
15-
lib-cov
16-
17-
# Coverage directory used by tools like istanbul
18-
coverage
19-
20-
# nyc test coverage
21-
.nyc_output
22-
23-
# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
24-
.grunt
25-
26-
# Bower dependency directory (https://bower.io/)
27-
bower_components
28-
29-
# node-waf configuration
30-
.lock-wscript
31-
32-
# Compiled binary addons (https://nodejs.org/api/addons.html)
33-
build/Release
34-
35-
# Dependency directories
36-
# node_modules/
37-
jspm_packages/
38-
39-
# TypeScript v1 declaration files
40-
typings/
41-
42-
# Optional npm cache directory
43-
.npm
441

452
# Optional eslint cache
463
.eslintcache
@@ -51,9 +8,6 @@ typings/
518
# Output of 'npm pack'
529
*.tgz
5310

54-
# Yarn Integrity file
55-
.yarn-integrity
56-
5711
# dotenv environment variables file
5812
.env
5913

@@ -63,5 +17,4 @@ typings/
6317
node_modules
6418
.idea
6519
.DS_Store
66-
6720
dist

.husky/.gitignore

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

.husky/pre-commit

Lines changed: 0 additions & 4 deletions
This file was deleted.

.npmignore

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,15 @@
1+
# Source files
12
src
2-
.babelrc
3-
!dist
3+
4+
# github workflows
5+
.github
6+
7+
# Tsup config
8+
tsup.config.ts
49

510
# Linter
611
.eslintignore
712
.eslintrc.json
8-
.prettierrc
913

1014
# IDE
1115
.idea
@@ -15,5 +19,11 @@ src
1519
node_modules/
1620
jspm_packages/
1721

22+
# Ts config file
23+
tsconfig.json
24+
1825
# Optional eslint cache
19-
.eslintcache
26+
.eslintcache
27+
28+
# optional snyk cache
29+
.dccache

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
# Changelogs
22

3+
## v0.0.14
4+
5+
### Added
6+
7+
- Added nonce support
8+
- Added autocomplete for advanced options
9+
310
## v0.0.13
411

512
### Fixed

README.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,16 @@ If no props are passed to `<NextNProgress />`, below is the default configuratio
5757

5858
### Advanced Config
5959

60+
#### Adding nonce
61+
62+
We use internal css in this package. If you are using csp, you can add nonce to the `<style>` tag by providing `nonce` prop to `<NextNProgress />` component.
63+
64+
```jsx
65+
<NextNProgress nonce="my-nonce" />
66+
```
67+
68+
#### Other Configs
69+
6070
You can use [other configurations](https://github.com/rstacruz/nprogress#configuration) which NProgress provides by adding a JSON in `options` props.
6171

6272
```jsx

0 commit comments

Comments
 (0)