-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Use` rollup-plugin-prettier` as example - Replace `jest` with `ava` - Generate TypeScript declaration files. Added `tsconfig.json` for that purpose - Wire up `prettier` and enhance ESLint configuration - Remove `.travis.yml` because of switching to GitHub Actions - Add `jsconfig.json` form improved JS typing - Set `rollup` and `eslint` as peer dependencies - Update dependencies
- Loading branch information
1 parent
89865fc
commit 28362e1
Showing
26 changed files
with
9,313 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
module.exports = { | ||
parser: '@babel/eslint-parser', | ||
parserOptions: { | ||
sourceType: 'module', | ||
}, | ||
root: true, | ||
ignorePatterns: [ | ||
'**/*.*', | ||
'!**/*.js', | ||
'tests/fixtures', | ||
'node_modules', | ||
'dist', | ||
], | ||
env: { | ||
node: true, | ||
}, | ||
plugins: ['prettier', 'standard', 'jsdoc'], | ||
extends: [ | ||
'standard', | ||
'prettier', | ||
'plugin:prettier/recommended', | ||
'prettier/standard', | ||
'plugin:node/recommended', | ||
'plugin:jsdoc/recommended', | ||
], | ||
settings: { | ||
jsdoc: { | ||
mode: 'typescript', | ||
}, | ||
}, | ||
rules: { | ||
'jsdoc/require-param-description': 'off', | ||
'jsdoc/require-returns-description': 'off', | ||
'node/no-unsupported-features/es-syntax': [ | ||
'error', | ||
{ | ||
ignores: ['modules'], | ||
}, | ||
], | ||
}, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
name: CI | ||
|
||
on: | ||
push: | ||
branches: [ main ] | ||
pull_request: | ||
branches: [ main ] | ||
|
||
jobs: | ||
build: | ||
|
||
strategy: | ||
matrix: | ||
node-version: [12.x, 14.x] | ||
os: [ windows-latest, ubuntu-latest, macos-latest ] | ||
|
||
runs-on: ${{ matrix.os }} | ||
|
||
steps: | ||
- run: git config --global core.autocrlf input | ||
- uses: actions/checkout@v2 | ||
- name: Use Node.js ${{ matrix.node-version }} | ||
uses: actions/setup-node@v1 | ||
with: | ||
node-version: ${{ matrix.node-version }} | ||
- run: npm ci | ||
- run: npm run build --if-present | ||
- run: npm test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
name: Publish to NPM | ||
|
||
on: | ||
release: | ||
types: [created] | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: actions/setup-node@v1 | ||
with: | ||
node-version: 12 | ||
- run: npm ci | ||
- run: npm test | ||
|
||
publish-npm: | ||
needs: build | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: actions/setup-node@v1 | ||
with: | ||
node-version: 12 | ||
registry-url: https://registry.npmjs.org/ | ||
- run: npm ci | ||
- run: npm publish | ||
env: | ||
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
.vscode | ||
/node_modules | ||
coverage | ||
.nyc_output | ||
dist |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
package.json | ||
package-lock.json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
module.exports = { | ||
printWidth: 80, | ||
singleQuote: true, | ||
semi: false, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# rollup-plugin-eslint-bundle changelog | ||
|
||
## 6.0.0 - 2021-01-24 | ||
* Rewrite from scratch for latest `rollup` and `ESLint` | ||
* Replace `jest` with `ava` | ||
* Require Node.js version >= 12 | ||
* Set `rollup` and `eslint` as peer dependencies | ||
* Generate TypeScript declaration files. | ||
|
||
## 5.0.2 - 2018-11-02 | ||
* Update dependencies | ||
|
||
## 5.0.1 - 2018-07-15 | ||
* Fix for case when fix doesn't produce output | ||
* Fixes for ESLint 5.x | ||
* Disable tests for source mapping. For some reason rollup returns the same 'mappings' for fixed and not fixed code even though the plugin produces different source maps | ||
* Update dependencies | ||
|
||
## 5.0.0 - 2018-01-21 | ||
* Rewrite to verify and fix the bundle instead of imported files |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
# rollup-plugin-eslint-bundle ![build](https://github.com/nikolay-borzov/rollup-plugin-eslint-bundle/workflows/CI/badge.svg) [![JavaScript Style Guide](https://img.shields.io/badge/code_style-standard-brightgreen.svg)](https://standardjs.com) | ||
|
||
[rollup]: https://github.com/rollup/rollup | ||
[eslint-config]: https://eslint.org/docs/developer-guide/nodejs-api#parameters | ||
|
||
[Rollup] plugin to lint (and fix) bundled code with ESLint. | ||
|
||
|
||
## Install | ||
|
||
```sh | ||
npm i rollup-plugin-eslint-bundle -D | ||
``` | ||
|
||
## Usage | ||
|
||
```js | ||
import { rollup } from 'rollup'; | ||
import { eslintBundle } from 'rollup-plugin-eslint-bundle'; | ||
|
||
rollup({ | ||
entry: 'main.js', | ||
plugins: [ | ||
eslintBundle({ | ||
eslintOptions: { | ||
fix: true | ||
}, | ||
throwOnWarning: true, | ||
throwOnError: true, | ||
formatter: 'compact' | ||
}) | ||
] | ||
}); | ||
``` | ||
|
||
## Options | ||
|
||
### `eslintOptions` | ||
|
||
[ESLint class options object](https://eslint.org/docs/developer-guide/nodejs-api#parameters). | ||
|
||
### `throwOnWarning` | ||
|
||
Type: `boolean` | ||
Default: `false` | ||
|
||
If true, will throw an error if any warnings were found. | ||
|
||
### `throwOnError` | ||
|
||
Type: `boolean` | ||
Default: `false` | ||
|
||
If true, will throw an error if any errors were found. | ||
|
||
### `formatter` | ||
|
||
Type: `string` | ||
|
||
[Value](https://eslint.org/docs/developer-guide/nodejs-api#-eslintloadformatternameorpath) to be passed to `eslint.loadFormatter()` | ||
|
||
## License | ||
|
||
MIT License (MIT) | ||
|
||
## Contributing | ||
|
||
If you find a bug or think about enhancement, feel free to contribute and submit an issue or a pull request. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
const path = require('path') | ||
const { eslintBundle } = require('../dist') | ||
|
||
module.exports = { | ||
input: path.resolve(__dirname, './src.js'), | ||
|
||
output: { | ||
file: path.resolve(__dirname, './dist/bundle.js'), | ||
format: 'es', | ||
sourcemap: true, | ||
plugins: [ | ||
eslintBundle({ | ||
eslintOptions: { | ||
fix: true, | ||
}, | ||
}), | ||
], | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
export default function() { | ||
var a = 6 | ||
if (!!foo) { | ||
debugger; | ||
return [a] | ||
} else { | ||
if(window) { return [1984, ]; } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
{ | ||
"compilerOptions": { | ||
"moduleResolution": "node", | ||
"resolveJsonModule": true, | ||
"checkJs": true, | ||
"strict": true | ||
}, | ||
"include": ["src", "tests"], | ||
"exclude": ["tests/fixtures"] | ||
} |
Oops, something went wrong.