Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
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
28 changes: 14 additions & 14 deletions packages/alias/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,16 +52,16 @@ module.exports = {
input: 'src/index.js',
output: {
dir: 'output',
format: 'cjs'
format: 'cjs',
},
plugins: [
alias({
entries: [
{ find: 'utils', replacement: '../../../utils' },
{ find: 'batman-1.0.0', replacement: './joker-1.5.0' }
]
})
]
{ find: 'batman-1.0.0', replacement: './joker-1.5.0' },
],
}),
],
};
```

Expand Down Expand Up @@ -91,8 +91,8 @@ The `Object` format allows specifying aliases as a key, and the corresponding va
alias({
entries: {
utils: '../../../utils',
'batman-1.0.0': './joker-1.5.0'
}
'batman-1.0.0': './joker-1.5.0',
},
});
```

Expand All @@ -103,7 +103,7 @@ The `Array[...Object]` format allows specifying aliases as objects, which can be
```js
entries: [
{ find: 'utils', replacement: '../../../utils' },
{ find: 'batman-1.0.0', replacement: './joker-1.5.0' }
{ find: 'batman-1.0.0', replacement: './joker-1.5.0' },
];
```

Expand Down Expand Up @@ -143,7 +143,7 @@ import alias from '@rollup/plugin-alias';
import resolve from '@rollup/plugin-node-resolve';

const customResolver = resolve({
extensions: ['.mjs', '.js', '.jsx', '.json', '.sass', '.scss']
extensions: ['.mjs', '.js', '.jsx', '.json', '.sass', '.scss'],
});
const projectRootDir = path.resolve(__dirname);

Expand All @@ -154,14 +154,14 @@ export default {
entries: [
{
find: 'src',
replacement: path.resolve(projectRootDir, 'src')
replacement: path.resolve(projectRootDir, 'src'),
// OR place `customResolver` here. See explanation below.
}
},
],
customResolver
customResolver,
}),
resolve()
]
resolve(),
],
};
```

Expand Down
40 changes: 20 additions & 20 deletions packages/babel/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,9 @@ const config = {
input: 'src/index.js',
output: {
dir: 'output',
format: 'esm'
format: 'esm',
},
plugins: [babel({ babelHelpers: 'bundled' })]
plugins: [babel({ babelHelpers: 'bundled' })],
};

export default config;
Expand Down Expand Up @@ -169,13 +169,13 @@ export default {
input: 'main.js',
plugins: [
getBabelOutputPlugin({
presets: ['@babel/preset-env']
})
presets: ['@babel/preset-env'],
}),
],
output: [
{ file: 'bundle.cjs.js', format: 'cjs' },
{ file: 'bundle.esm.js', format: 'esm' }
]
{ file: 'bundle.esm.js', format: 'esm' },
],
};
```

Expand All @@ -192,9 +192,9 @@ export default {
{
file: 'bundle.es5.js',
format: 'esm',
plugins: [getBabelOutputPlugin({ presets: ['@babel/preset-env'] })]
}
]
plugins: [getBabelOutputPlugin({ presets: ['@babel/preset-env'] })],
},
],
};
```

Expand All @@ -213,9 +213,9 @@ export default {
{
file: 'bundle.js',
format: 'esm',
plugins: [getBabelOutputPlugin({ presets: ['@babel/preset-env'] })]
}
]
plugins: [getBabelOutputPlugin({ presets: ['@babel/preset-env'] })],
},
],
};
```

Expand All @@ -225,7 +225,7 @@ Unlike the regular `babel` plugin, `getBabelOutputPlugin(...)` will **not** auto

```js
getBabelOutputPlugin({
configFile: path.resolve(__dirname, 'babel.config.js')
configFile: path.resolve(__dirname, 'babel.config.js'),
});
```

Expand Down Expand Up @@ -327,10 +327,10 @@ It's main purpose is to allow other tools for configuration of transpilation wit
```js
import { createBabelInputPluginFactory } from '@rollup/plugin-babel';

export default createBabelInputPluginFactory(babelCore => {
export default createBabelInputPluginFactory((babelCore) => {
function myPlugin() {
return {
visitor: {}
visitor: {},
};
}

Expand All @@ -342,7 +342,7 @@ export default createBabelInputPluginFactory(babelCore => {
customOptions: { opt1, opt2 },

// Pass the options back with the two custom options removed.
pluginOptions
pluginOptions,
};
},

Expand All @@ -358,17 +358,17 @@ export default createBabelInputPluginFactory(babelCore => {
...(cfg.options.plugins || []),

// Include a custom plugin in the options.
myPlugin
]
myPlugin,
],
};
},

result(result, { code, customOptions, config, transformOptions }) {
return {
...result,
code: result.code + '\n// Generated by some custom plugin'
code: result.code + '\n// Generated by some custom plugin',
};
}
},
};
});
```
Expand Down
1 change: 0 additions & 1 deletion packages/eslint/.eslintignore

This file was deleted.

1 change: 0 additions & 1 deletion packages/eslint/.gitignore

This file was deleted.

93 changes: 54 additions & 39 deletions packages/eslint/README.md
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
[npm]: https://img.shields.io/npm/v/@rollup/plugin-alias
[npm-url]: https://www.npmjs.com/package/@rollup/plugin-alias
[size]: https://packagephobia.now.sh/badge?p=@rollup/plugin-alias
[size-url]: https://packagephobia.now.sh/result?p=@rollup/plugin-alias
[npm]: https://img.shields.io/npm/v/@rollup/plugin-eslint
[npm-url]: https://www.npmjs.com/package/@rollup/plugin-eslint
[size]: https://packagephobia.now.sh/badge?p=@rollup/plugin-eslint
[size-url]: https://packagephobia.now.sh/result?p=@rollup/plugin-eslint

[![npm][npm]][npm-url]
[![size][size]][size-url]
[![libera manifesto](https://img.shields.io/badge/libera-manifesto-lightgrey.svg)](https://liberamanifesto.com)

# @rollup/plugin-eslint

🍣 A Rollup plugin to lint entry points and all imported files with ESLint.
🍣 A Rollup plugin to lint your source files with ESLint.

## Install

Using npm:

```console
# using npm
npm install @rollup/plugin-eslint --save-dev
# or
yarn add -D @rollup/plugin-eslint

# using yarn
yarn add @rollup/plugin-eslint --dev
```

## Usage
Expand All @@ -27,62 +27,77 @@ yarn add -D @rollup/plugin-eslint
import eslint from '@rollup/plugin-eslint';

export default {
input: 'main.js',
input: 'src',
plugins: [
eslint({
/* your options */
})
]
/* options */
}),
],
output: {
/* ... */
},
};
```

## Options

See more options here [eslint-config](http://eslint.org/docs/developer-guide/nodejs-api#cliengine).
This plugin respects your [ESLint configuration](https://eslint.org/docs/user-guide/configuring) as per default. It also takes a configuration object intended for the [ESLint constructor](https://eslint.org/docs/developer-guide/nodejs-api#-new-eslintoptions) with the addition of a `throwOnWarning`, `throwOnError`, `formatter`, `include` and `exclude` prop. The most popular configuration options are as follows:

### `fix`

Type: `boolean`<br>
Default: `false`<br>
Utilized by: [ESLint constructor](https://eslint.org/docs/developer-guide/nodejs-api#-new-eslintoptions)

You can also use eslint configuration in the form of a `.eslintrc.*` file in your project's root. It will be loaded automatically.
Controls whether to enable or disable the autofix feature of ESLint.

### fix
### `extensions`

Type: `Boolean`<br>
Default: `false`
Type: `string[]`<br>
Default: `null`<br>
Utilized by: [ESLint constructor](https://eslint.org/docs/developer-guide/nodejs-api#-new-eslintoptions)

If true, will auto fix source code.
Controls what type of files ESLint should look at. The default of `null` is equal to `[ '.js' ]`.

### throwOnError
### `throwOnWarning`

Type: `Boolean`<br>
Default: `false`
Type: `boolean`<br>
Default: `false`<br>
Utilized by: [The plugin itself](src/index.ts#L40)

If true, will throw an error if any errors were found.
Controls whether or not to throw an error and exit the process when ESLint reports any warnings.

### throwOnWarning
### `throwOnError`

Type: `Boolean`<br>
Default: `false`
Type: `boolean`<br>
Default: `false`<br>
Utilized by: [The plugin itself](src/index.ts#L46)

If true, will throw an error if any warnings were found.
Controls whether or not to throw an error and exit the process when ESLint reports any errors.

### include
### `formatter`

Type: `Array | String`<br>
Default: `[]`
Type: `string`<br>
Default: `'stylish'`<br>
Utilized by: [The plugin itself](src/index.ts#L32)

A single file, or array of files, to include when linting.
The name of a (built-in) formatter or the path to a custom formatter.

### exclude
### `include`

Type: `Array | String`<br>
Default: `node_modules/**`
Type: `string | string[]`<br>
Default: `undefined`<br>
Utilized by: [`@rollup/pluginutils`](https://github.com/rollup/plugins/tree/master/packages/pluginutils#createfilter)

A single file, or array of files, to exclude when linting.
A single [`picomatch`](https://github.com/micromatch/picomatch) pattern or an array of patterns controlling which files this plugin should explicitly include. Gets forwarded to the [`createFilter`](https://github.com/rollup/plugins/tree/master/packages/pluginutils#createfilter) method of `@rollup/pluginutils`.

### formatter
### `exclude`

Type: `Function | String`<br>
Default: `stylish`
Type: `string | string[]`<br>
Default: `'node_modules/**'`<br>
Utilized by: [`@rollup/pluginutils`](https://github.com/rollup/plugins/tree/master/packages/pluginutils#createfilter)

Custom error formatter or the name of a built-in formatter.
A single [`picomatch`](https://github.com/micromatch/picomatch) pattern or an array of patterns controlling which files this plugin should explicitly exclude. Gets forwarded to the [`createFilter`](https://github.com/rollup/plugins/tree/master/packages/pluginutils#createfilter) method of `@rollup/pluginutils`.

## Meta

Expand Down
Loading