# eslint-plugin-angular-file-naming

> ESLint plugin for Angular file naming conventions

Latest version **1.0.6** (published 2022-11-12) · MIT license · 0 weekly downloads

## Install

```sh
npm install eslint-plugin-angular-file-naming
pnpm add eslint-plugin-angular-file-naming
yarn add eslint-plugin-angular-file-naming
bun add eslint-plugin-angular-file-naming
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.6 |
| Published | 2022-11-12 |
| First published | 2021-07-23 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 53.4 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | Takuya Nakayasu |
| Maintainers | takuya.nakayasu |
| Keywords | eslint, eslintplugin, eslint-plugin, angular |

## Links

- npm: https://www.npmjs.com/package/eslint-plugin-angular-file-naming
- Repository: https://github.com/takuya-nakayasu/eslint-plugin-angular-file-naming
- Issues: https://github.com/takuya-nakayasu/eslint-plugin-angular-file-naming/issues
- npm.io page: https://npm.io/package/eslint-plugin-angular-file-naming

## Alternatives

- [eslint-plugin-sonarjs](https://npm.io/package/eslint-plugin-sonarjs.md) — 2.9M weekly downloads
- [eslint-config-expo](https://npm.io/package/eslint-config-expo.md) — 1.5M weekly downloads
- [@matter/protocol](https://npm.io/package/@matter/protocol.md) — 63.5K weekly downloads
- [@eventcatalog/linter](https://npm.io/package/@eventcatalog/linter.md) — 24.8K weekly downloads
- [@inrupt/eslint-config-base](https://npm.io/package/@inrupt/eslint-config-base.md) — 4.5K weekly downloads

## Recent versions

- 1.0.6 (latest) — 2022-11-12
- 1.0.5 — 2022-11-12
- 1.0.4 — 2022-11-06
- 1.0.3 — 2022-02-13
- 1.0.2 — 2021-09-11
- 1.0.1 — 2021-07-23
- 1.0.0 — 2021-07-23
- 0.1.0 — 2021-07-23

## README

# eslint-plugin-angular-file-naming

[![npm version](https://img.shields.io/npm/v/eslint-plugin-angular-file-naming.svg)](https://www.npmjs.com/package/eslint-plugin-angular-file-naming)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
[![Twitter](https://img.shields.io/twitter/follow/takuya_nakayasu?style=social)](https://twitter.com/takuya_nakayasu)

An ESLint plugin that enforce the filename to have a appropriate suffix (such as `.component.ts`, `.directive.ts`, `.module.ts`, `.pipe.ts`, or `.service.ts`).

**Please note**: This plugin will only lint the filenames of the `.ts` files you are linting with eslint. It will ignore other files that are not linted with eslint.

| File type | Appropriate suffix of the filename |
| --------- | ---------------------------------- |
| Component | `.component.ts`                    |
| Directive | `.directive.ts`                    |
| Module    | `.module.ts`                       |
| Pipe      | `.pipe.ts`                         |
| Service   | `.service.ts`                      |

## Installation

```
npm install --save-dev eslint-plugin-angular-file-naming
```

Or

```
yarn add --dev eslint-plugin-angular-file-naming
```

## Usage

Modify your `.eslintrc`

```js
// .eslintrc.json
module.exports = {
  "plugins": [
    ...,
    "angular-file-naming"
  ],
  "rules": [
    ...,
    "angular-file-naming/component-filename-suffix": "error",
    "angular-file-naming/directive-filename-suffix": "error",
    "angular-file-naming/module-filename-suffix": "error",
    "angular-file-naming/pipe-filename-suffix": "error",
    "angular-file-naming/service-filename-suffix": "error",
  ]
  ...,
}
```

## Rules

| Rule ID                                                                | Description                                                     |
| ---------------------------------------------------------------------- | --------------------------------------------------------------- |
| [component-filename-suffix](./docs/rules/component-filename-suffix.md) | Enforces the file name of components to have a specified suffix |
| [directive-filename-suffix](./docs/rules/directive-filename-suffix.md) | Enforces the file name of directives to have a specified suffix |
| [module-filename-suffix](./docs/rules/module-filename-suffix.md)       | Enforces the file name of modules to have a specified suffix    |
| [pipe-filename-suffix](./docs/rules/pipe-filename-suffix.md)           | Enforces the file name of pipes to have a specified suffix      |
| [service-filename-suffix](./docs/rules/service-filename-suffix.md)     | Enforces the file name of services to have a specified suffix   |

## Examples

For example:

```js
// .eslintrc.json
module.exports = {
  "plugins": [
    ...,
    "angular-file-naming"
  ],
  "rules": [
    ...,
    "angular-file-naming/component-filename-suffix": [
      "error",
      {
        "suffixes": ["component", "page", "view", "component.mock"]
      }
    ],
    "angular-file-naming/directive-filename-suffix": "error",
    "angular-file-naming/module-filename-suffix": "error",
    "angular-file-naming/pipe-filename-suffix": "error",
    "angular-file-naming/service-filename-suffix": [
      "error",
      {
        "suffixes": ["service", "guard", "store", "service.mock"]
      }
    ],
  ]
  ...,
}
```

Examples of **incorrect** file name with the above configuration:

```
app.comp.ts
app.mock.ts
sample.ts
test.filter.ts
test.mock.ts
```

Example of **correct** file name with the above configuration:

```
app.component.ts
app.page.ts
app.view.ts
app.component.mock.ts
test.directive.ts
app.module.ts
sample.pipe.ts
test.service.ts
test.service.mock.ts
test.guard.ts
test.store.ts
```

## License

MIT

---
_Source: https://npm.io/package/eslint-plugin-angular-file-naming · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
