open-index/open-npm huggingface dataset:
npm package: @marudor/babel-plugin-transform-assets-import-to-string
Description: Babel plugin that transforms image assets import and requires to urls / cdn
Author: marudor
Latest version: 1.2.1

# babel-plugin-transform-assets-import-to-string

> Babel plugin that transforms image assets import and requires to urls / cdn

## Table of Contents

-   [About](#about)
-   [Installation](#installation)
-   [Usage](#usage)
    -   [via babelrc](#via-babelrc)
    -   [via Node API](#via-node-api)

## About

This [babel](https://babeljs.io/) plugin allows you to transform asset files into a string uri, allowing you to point your assets to CDN or other hosts, without needing to run your code through module bundlers.

This helps when doing _isomorphic_ / server-rendered applications.

```js
import image from '../path/assets/icon.svg';
const image1 = require('../path/assets/icon1.svg');

// to

const image = 'http://your.cdn.address/assets/icon.svg';
const image1 = 'http://your.cdn.address/assets/icon1.svg';

// Somewhere further down in your code:
//
// eg: JSX
// <img src={image} alt='' />
//
// eg: Other cases
// ajaxAsyncRequest(image)
```

See the spec for more [examples](https://github.com/marudor/babel-plugin-transform-assets-import-to-string/blob/master/test/index.spec.js).

## Installation

```
$> npm install @marudor/babel-plugin-transform-assets-import-to-string --save
```

## Usage

### via .babelrc

```json
{
    "plugins": [
        [
            "@marudor/babel-plugin-transform-assets-import-to-string",
            {
                "baseDir": "/assets",
                "baseUri": "http://your.cdn.address"
            }
        ]
    ]
}
```

### via Node API

```js
require('babel-core').transform('code', {
    plugins: [
        [
            '@marudor/babel-plugin-transform-assets-import-to-string',
            {
                baseDir: '/assets',
                baseUri: 'http://your.cdn.address',
            },
        ],
    ],
});
```

By default, it will transform the following extensions: `.gif, .jpeg, .jpg, .png, .svg` if `extensions` option is not defined. To configure a custom list, just add the `extensions` array as an option.

**Note:** leading `.` (dot) is required.

```json
{
    "plugins": [
        [
            "@marudor/babel-plugin-transform-assets-import-to-string",
            {
                "extensions": [".jpg", ".png"]
            }
        ]
    ]
}
```

## License

`@marudor/babel-plugin-babel-plugin-transform-assets-import-to-string` is [MIT licensed](./LICENSE)
npm package: @marudor/eslint-plugin-header
Description: ESLint plugin to ensure that files begin with given comment
Author: Stuart Knightley
Latest version: 2.0.0

eslint-plugin-header
====================

ESLint plugin to ensure that files begin with given comment.

Often you will want to have a copyright notice at the top of every file. This ESLint plugin checks that the first comment in every file has the contents defined in the rule settings.

## Usage

This rule takes 1 or 2 arguments with an optional settings object.

### 1 argument

In the 1 argument form the argument is the filename of a file that contains the comment(s) that should appear at the top of every file:

```json
{
    "plugins": [
        "header"
    ],
    "rules": {
        "header/header": [2, "config/header.js"]
    }
}
```

config/header.js:

```js
// Copyright 2015
// My company
```

Due to limitations in eslint plugins, the file is read relative to the working directory that eslint is executed in. If you run eslint from elsewhere in your tree then the header file will not be found.

### 2 arguments

In the 2 argument form the first must be either `"block"` or `"line"` to indicate what style of comment should be used. The second is either a string (including newlines) of the comment, or an array of each line of the comment.

```json
{
    "plugins": [
        "header"
    ],
    "rules": {
        "header/header": [2, "block", "Copyright 2015\nMy Company"]
    }
}
```

Instead of a string to be checked for exact matching you can also supply a regular expression (beware that you have to quote backslashes):

```json
{
    "plugins": [
        "header"
    ],
    "rules": {
        "header/header": [2, "block", {"pattern": "^ Copyright \\d{4}\\n My Company$"}]
    }
}
```

### Line Endings

The rule works with both unix and windows line endings. For ESLint `--fix`, the rule will use the line ending format of the current operating system (via the node `os` package). This setting can be overwritten as follows:
```json
"rules": {
    "header/header": [2, "block", ["Copyright 2018", "My Company"], {"lineEndings": "windows"}]
}
```
Possible values are `unix` for `\n` and `windows` for `\r\n` line endings.

## Examples

The following examples are all valid.

`"block", "Copyright 2015, My Company"`:

```js
/*Copyright 2015, My Company*/
console.log(1);
```

`"line", ["Copyright 2015", "My Company"]]`:

```js
//Copyright 2015
//My Company
console.log(1)
```

`"line", [{pattern: "^Copyright \\d{4}$"}, {pattern: "^My Company$"}]]`:

```js
//Copyright 2017
//My Company
console.log(1)
```

### With more decoration

```json
"header/header": [2, "block", [
    "************************",
    " * Copyright 2015",
    " * My Company",
    " ************************"
]
```

```js
/*************************
 * Copyright 2015
 * My Company
 *************************/
 console.log(1);
```

## License

MIT