Skip to content

Commit 0864f54

Browse files
committed
Implementation
1 parent 3dc4374 commit 0864f54

File tree

90 files changed

+6338
-3
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

90 files changed

+6338
-3
lines changed

.eslintignore

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
/.nyc_output
2+
/coverage
3+
/node_modules
4+
/assets
5+
/dist
6+
/docs/.vuepress/dist
7+
/docs/.vuepress/components/demo/demo-code.js

.eslintrc.js

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
"use strict"
2+
3+
// const version = require("./package.json").version
4+
5+
module.exports = {
6+
parserOptions: {
7+
sourceType: "script",
8+
ecmaVersion: 2020,
9+
},
10+
extends: [
11+
"plugin:@mysticatea/es2015",
12+
"plugin:@mysticatea/+node",
13+
"plugin:@mysticatea/+eslint-plugin",
14+
],
15+
rules: {
16+
"require-jsdoc": "error",
17+
"no-warning-comments": "warn",
18+
"no-lonely-if": "off",
19+
"@mysticatea/ts/ban-ts-ignore": "off",
20+
},
21+
overrides: [
22+
{
23+
files: ["*.ts"],
24+
rules: {
25+
// "@mysticatea/ts/no-require-imports": "off",
26+
// "@mysticatea/ts/no-var-requires": "off",
27+
"@mysticatea/node/no-missing-import": "off",
28+
"no-implicit-globals": "off",
29+
"@mysticatea/node/no-extraneous-import": "off",
30+
},
31+
parserOptions: {
32+
sourceType: "module",
33+
project: "./tsconfig.json",
34+
},
35+
},
36+
{
37+
files: ["lib/rules/**"],
38+
rules: {
39+
"@mysticatea/eslint-plugin/report-message-format": [
40+
"error",
41+
"[^a-z].*\\.$",
42+
],
43+
"@mysticatea/eslint-plugin/require-meta-docs-url": "off",
44+
},
45+
},
46+
{
47+
files: ["scripts/**/*.ts", "tests/**/*.ts"],
48+
rules: {
49+
"require-jsdoc": "off",
50+
"no-console": "off",
51+
},
52+
},
53+
{
54+
files: ["*.vue"],
55+
parserOptions: {
56+
sourceType: "module",
57+
},
58+
globals: {
59+
require: true,
60+
},
61+
},
62+
{
63+
files: ["docs/.vuepress/**"],
64+
parserOptions: {
65+
sourceType: "module",
66+
ecmaVersion: 2020,
67+
parser: "babel-eslint",
68+
},
69+
globals: {
70+
window: true,
71+
},
72+
rules: {
73+
"require-jsdoc": "off",
74+
"@mysticatea/vue/html-closing-bracket-newline": "off",
75+
"@mysticatea/vue/max-attributes-per-line": "off",
76+
"@mysticatea/vue/comma-dangle": "off",
77+
"@mysticatea/vue/html-indent": "off",
78+
"@mysticatea/vue/html-self-closing": "off",
79+
"@mysticatea/node/no-unsupported-features/es-syntax": "off",
80+
"@mysticatea/node/no-missing-import": "off",
81+
"@mysticatea/node/no-missing-require": "off",
82+
},
83+
},
84+
],
85+
}

.github/workflows/NodeCI.yml

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [master]
6+
pull_request:
7+
branches: [master]
8+
9+
jobs:
10+
lint:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v1
14+
- uses: actions/setup-node@v1
15+
with:
16+
node-version: 14
17+
- name: Install Packages
18+
run: npm install
19+
- name: Lint
20+
run: npm run lint
21+
test:
22+
runs-on: ubuntu-latest
23+
strategy:
24+
matrix:
25+
node-version: [10.13.x, 12.x, 13.x, 14.x]
26+
steps:
27+
- uses: actions/checkout@v1
28+
- name: Use Node.js ${{ matrix.node-version }}
29+
uses: actions/setup-node@v1
30+
with:
31+
node-version: ${{ matrix.node-version }}
32+
- name: Install Packages
33+
run: npm install
34+
- name: Test
35+
run: npm test
36+
test-with-eslint6:
37+
runs-on: ubuntu-latest
38+
steps:
39+
- uses: actions/checkout@v1
40+
- uses: actions/setup-node@v1
41+
with:
42+
node-version: 8.10.x
43+
- name: Install Target Packages
44+
run: |+
45+
46+
npx rimraf node_modules
47+
npm install
48+
- name: Test
49+
run: npm test
50+
test-and-coverage:
51+
runs-on: ubuntu-latest
52+
steps:
53+
- uses: actions/checkout@v1
54+
- uses: actions/setup-node@v1
55+
- name: Install Packages
56+
run: npm install
57+
- name: Test
58+
run: npm run test:nyc
59+
- name: Coveralls GitHub Action
60+
uses: coverallsapp/[email protected]
61+
with:
62+
github-token: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/NpmPublish.yml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
name: publish
2+
on:
3+
push:
4+
tags:
5+
- "*"
6+
jobs:
7+
release:
8+
name: check version, and release
9+
runs-on: ubuntu-latest
10+
steps:
11+
- name: checkout
12+
uses: actions/checkout@v1
13+
- name: setup Node
14+
uses: actions/setup-node@v1
15+
with:
16+
registry-url: 'https://registry.npmjs.org'
17+
- name: Install Packages
18+
run: npm install
19+
- name: test
20+
run: npm run test
21+
- name: check can npm-publish
22+
run: npx can-npm-publish
23+
- name: release
24+
run: npm publish
25+
env:
26+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

.gitignore

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ node_modules/
4242
jspm_packages/
4343

4444
# TypeScript v1 declaration files
45-
typings/
45+
# typings/
4646

4747
# TypeScript cache
4848
*.tsbuildinfo
@@ -102,3 +102,11 @@ dist
102102

103103
# TernJS port file
104104
.tern-port
105+
106+
# docs
107+
/404.html
108+
/index.html
109+
/assets
110+
/playground
111+
/rules
112+
/user-guide

.npmrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
package-lock=false

.vscode/settings.json

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
{
2+
"eslint.validate": [
3+
"javascript",
4+
"javascriptreact",
5+
"vue",
6+
"typescript"
7+
],
8+
"typescript.validate.enable": true,
9+
"javascript.validate.enable": false,
10+
"eslint.workingDirectories": [
11+
"./", "./docs/.vuepress"
12+
],
13+
"vetur.validation.script": false,
14+
"vetur.validation.style": false,
15+
"css.validate": false,
16+
"typescript.tsdk": "node_modules/typescript/lib",
17+
"editor.codeActionsOnSave": {
18+
"source.fixAll.eslint": true,
19+
"source.fixAll.stylelint": true,
20+
},
21+
"stylelint.customSyntax": "stylelint-plugin-stylus/custom-syntax",
22+
"stylelint.validate": [
23+
"css",
24+
"html",
25+
"less",
26+
"postcss",
27+
"sass",
28+
"scss",
29+
"vue",
30+
"vue-html",
31+
"vue-postcss",
32+
"stylus"
33+
]
34+
}

README.md

Lines changed: 116 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,116 @@
1-
# eslint-plugin-regexp
2-
ESLint plugin for finding regex mistakes and style guide violations.
1+
# Introduction
2+
3+
[eslint-plugin-regexp](https://www.npmjs.com/package/eslint-plugin-regexp) is ESLint plugin for finding RegExp mistakes and RegExp style guide violations.
4+
5+
[![NPM license](https://img.shields.io/npm/l/eslint-plugin-regexp.svg)](https://www.npmjs.com/package/eslint-plugin-regexp)
6+
[![NPM version](https://img.shields.io/npm/v/eslint-plugin-regexp.svg)](https://www.npmjs.com/package/eslint-plugin-regexp)
7+
[![NPM downloads](https://img.shields.io/badge/dynamic/json.svg?label=downloads&colorB=green&suffix=/day&query=$.downloads&uri=https://api.npmjs.org//downloads/point/last-day/eslint-plugin-regexp&maxAge=3600)](http://www.npmtrends.com/eslint-plugin-regexp)
8+
[![NPM downloads](https://img.shields.io/npm/dw/eslint-plugin-regexp.svg)](http://www.npmtrends.com/eslint-plugin-regexp)
9+
[![NPM downloads](https://img.shields.io/npm/dm/eslint-plugin-regexp.svg)](http://www.npmtrends.com/eslint-plugin-regexp)
10+
[![NPM downloads](https://img.shields.io/npm/dy/eslint-plugin-regexp.svg)](http://www.npmtrends.com/eslint-plugin-regexp)
11+
[![NPM downloads](https://img.shields.io/npm/dt/eslint-plugin-regexp.svg)](http://www.npmtrends.com/eslint-plugin-regexp)
12+
[![Build Status](https://github.com/ota-meshi/eslint-plugin-regexp/workflows/CI/badge.svg?branch=master)](https://github.com/ota-meshi/eslint-plugin-regexp/actions?query=workflow%3ACI)
13+
[![Coverage Status](https://coveralls.io/repos/github/ota-meshi/eslint-plugin-regexp/badge.svg?branch=master)](https://coveralls.io/github/ota-meshi/eslint-plugin-regexp?branch=master)
14+
15+
## Features
16+
17+
This ESLint plugin provides linting rules relate to better ways to help you avoid problems when using RegExp.
18+
19+
You can check on the [Online DEMO](https://ota-meshi.github.io/eslint-plugin-regexp/playground/).
20+
21+
<!--DOCS_IGNORE_START-->
22+
23+
## Documentation
24+
25+
See [documents](https://ota-meshi.github.io/eslint-plugin-regexp/).
26+
27+
## Installation
28+
29+
```bash
30+
npm install --save-dev eslint eslint-plugin-regexp
31+
```
32+
33+
> **Requirements**
34+
>
35+
> - ESLint v5.0.0 and above
36+
> - Node.js v8.10.0 and above
37+
38+
<!--DOCS_IGNORE_END-->
39+
40+
## Usage
41+
42+
<!--USAGE_SECTION_START-->
43+
44+
Create `.eslintrc.*` file to configure rules. See also: [http://eslint.org/docs/user-guide/configuring](http://eslint.org/docs/user-guide/configuring).
45+
46+
Example **.eslintrc.js**:
47+
48+
```js
49+
module.exports = {
50+
extends: [
51+
// add more generic rulesets here, such as:
52+
// 'eslint:recommended',
53+
'plugin:regexp/recommended'
54+
],
55+
rules: {
56+
// override/add rules settings here, such as:
57+
// 'regexp/rule-name': 'error'
58+
}
59+
}
60+
```
61+
62+
## Configs
63+
64+
This plugin provides one config:
65+
66+
- `plugin:regexp/recommended` ... This is the recommended configuration for this plugin.
67+
68+
<!--USAGE_SECTION_END-->
69+
70+
## Rules
71+
72+
<!--RULES_SECTION_START-->
73+
74+
The `--fix` option on the [command line](https://eslint.org/docs/user-guide/command-line-interface#fixing-problems) automatically fixes problems reported by rules which have a wrench :wrench: below.
75+
The rules with the following star :star: are included in the `plugin:regexp/recommended` config.
76+
77+
<!--RULES_TABLE_START-->
78+
79+
| Rule ID | Description | |
80+
|:--------|:------------|:---|
81+
| [regexp/match-any](https://ota-meshi.github.io/eslint-plugin-regexp/rules/match-any.html) | enforce match any character style | :star::wrench: |
82+
| [regexp/no-assertion-capturing-group](https://ota-meshi.github.io/eslint-plugin-regexp/rules/no-assertion-capturing-group.html) | disallow capturing group that captures assertions. | :star: |
83+
| [regexp/no-dupe-characters-character-class](https://ota-meshi.github.io/eslint-plugin-regexp/rules/no-dupe-characters-character-class.html) | disallow duplicate characters in the RegExp character class | :star: |
84+
| [regexp/no-empty-group](https://ota-meshi.github.io/eslint-plugin-regexp/rules/no-empty-group.html) | disallow empty group | :star: |
85+
| [regexp/no-empty-lookarounds-assertion](https://ota-meshi.github.io/eslint-plugin-regexp/rules/no-empty-lookarounds-assertion.html) | disallow empty lookahead assertion or empty lookbehind assertion | :star: |
86+
| [regexp/no-escape-backspace](https://ota-meshi.github.io/eslint-plugin-regexp/rules/no-escape-backspace.html) | disallow escape backspace (`[\b]`) | :star: |
87+
| [regexp/no-octal](https://ota-meshi.github.io/eslint-plugin-regexp/rules/no-octal.html) | disallow octal escape sequence | :star: |
88+
| [regexp/no-useless-exactly-quantifier](https://ota-meshi.github.io/eslint-plugin-regexp/rules/no-useless-exactly-quantifier.html) | disallow unnecessary exactly quantifier | :star: |
89+
| [regexp/prefer-d](https://ota-meshi.github.io/eslint-plugin-regexp/rules/prefer-d.html) | enforce using `\d` | :star::wrench: |
90+
| [regexp/prefer-plus-quantifier](https://ota-meshi.github.io/eslint-plugin-regexp/rules/prefer-plus-quantifier.html) | enforce using `+` quantifier | :star::wrench: |
91+
| [regexp/prefer-question-quantifier](https://ota-meshi.github.io/eslint-plugin-regexp/rules/prefer-question-quantifier.html) | enforce using `?` quantifier | :star::wrench: |
92+
| [regexp/prefer-star-quantifier](https://ota-meshi.github.io/eslint-plugin-regexp/rules/prefer-star-quantifier.html) | enforce using `*` quantifier | :star::wrench: |
93+
| [regexp/prefer-t](https://ota-meshi.github.io/eslint-plugin-regexp/rules/prefer-t.html) | enforce using `\t` | :star::wrench: |
94+
| [regexp/prefer-w](https://ota-meshi.github.io/eslint-plugin-regexp/rules/prefer-w.html) | enforce using `\w` | :star::wrench: |
95+
96+
<!--RULES_TABLE_END-->
97+
<!--RULES_SECTION_END-->
98+
99+
<!--DOCS_IGNORE_START-->
100+
101+
## Contributing
102+
103+
Welcome contributing!
104+
105+
Please use GitHub's Issues/PRs.
106+
107+
### Development Tools
108+
109+
- `npm test` runs tests and measures coverage.
110+
- `npm run update` runs in order to update readme and recommended configuration.
111+
112+
<!--DOCS_IGNORE_END-->
113+
114+
## License
115+
116+
See the [LICENSE](LICENSE) file for license rights and limitations (MIT).

0 commit comments

Comments
 (0)