-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
fa05b8d
commit faf1ebc
Showing
67 changed files
with
4,468 additions
and
4,543 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 |
---|---|---|
@@ -1,9 +1,9 @@ | ||
root = true | ||
|
||
[*] | ||
indent_style = space | ||
indent_size = 4 | ||
end_of_line = lf | ||
charset = utf-8 | ||
trim_trailing_whitespace = true | ||
insert_final_newline = true | ||
root = true | ||
|
||
[*] | ||
indent_style = space | ||
indent_size = 4 | ||
end_of_line = lf | ||
charset = utf-8 | ||
trim_trailing_whitespace = true | ||
insert_final_newline = true |
36 changes: 18 additions & 18 deletions
36
.github/ISSUE_TEMPLATE/bug-report--eslint-plugin-autofix.md
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 |
---|---|---|
@@ -1,18 +1,18 @@ | ||
--- | ||
name: 'bug report: eslint-plugin-autofix' | ||
about: Create a report to help us improve | ||
title: eslint-plugin-autofix bug | ||
labels: bug | ||
assignees: aladdin-add | ||
|
||
--- | ||
|
||
**Tell us about your environment** | ||
|
||
* **eslint version:** | ||
* **eslint-plugin-autofix version:** | ||
* **eslint config:** | ||
|
||
**Expected behavior** | ||
|
||
**Actual behavior** | ||
--- | ||
name: 'bug report: eslint-plugin-autofix' | ||
about: Create a report to help us improve | ||
title: eslint-plugin-autofix bug | ||
labels: bug | ||
assignees: aladdin-add | ||
|
||
--- | ||
|
||
**Tell us about your environment** | ||
|
||
* **eslint version:** | ||
* **eslint-plugin-autofix version:** | ||
* **eslint config:** | ||
|
||
**Expected behavior** | ||
|
||
**Actual behavior** |
36 changes: 18 additions & 18 deletions
36
.github/ISSUE_TEMPLATE/bug-report--eslint-plugin-no-autofix.md
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 |
---|---|---|
@@ -1,18 +1,18 @@ | ||
--- | ||
name: 'bug report: eslint-plugin-no-autofix' | ||
about: eslint-plugin-no-autofix | ||
title: 'bug report: eslint-plugin-no-autofix' | ||
labels: bug | ||
assignees: aladdin-add | ||
|
||
--- | ||
|
||
**Tell us about your environment** | ||
|
||
* **eslint version:** | ||
* **eslint-plugin-no-autofix version:** | ||
* **eslint config:** | ||
|
||
**Expected behavior** | ||
|
||
**Actual behavior** | ||
--- | ||
name: 'bug report: eslint-plugin-no-autofix' | ||
about: eslint-plugin-no-autofix | ||
title: 'bug report: eslint-plugin-no-autofix' | ||
labels: bug | ||
assignees: aladdin-add | ||
|
||
--- | ||
|
||
**Tell us about your environment** | ||
|
||
* **eslint version:** | ||
* **eslint-plugin-no-autofix version:** | ||
* **eslint config:** | ||
|
||
**Expected behavior** | ||
|
||
**Actual behavior** |
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 |
---|---|---|
@@ -1,10 +1,10 @@ | ||
node_modules | ||
dist | ||
coverage/ | ||
npm-debug.log | ||
.DS_Store | ||
.idea | ||
*.iml | ||
.cache | ||
/.vscode | ||
.sublimelinterrc | ||
node_modules | ||
dist | ||
coverage/ | ||
npm-debug.log | ||
.DS_Store | ||
.idea | ||
*.iml | ||
.cache | ||
/.vscode | ||
.sublimelinterrc |
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 |
---|---|---|
@@ -1 +1 @@ | ||
package-lock=false | ||
package-lock=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 |
---|---|---|
@@ -1,28 +1,28 @@ | ||
# AppVeyor file | ||
# http://www.appveyor.com/docs/appveyor-yml | ||
|
||
# Build version format | ||
version: "{build}" | ||
|
||
# What combinations to test | ||
environment: | ||
matrix: | ||
- nodejs_version: 8 | ||
|
||
branches: | ||
only: | ||
- master | ||
|
||
install: | ||
# Get the latest stable version of Node.js | ||
- ps: Install-Product node $env:nodejs_version | ||
# install modules | ||
- npm install | ||
|
||
build: off | ||
|
||
test_script: | ||
- npm test | ||
|
||
matrix: | ||
fast_finish: true # set this flag to immediately finish build once one of the jobs fails. | ||
# AppVeyor file | ||
# http://www.appveyor.com/docs/appveyor-yml | ||
|
||
# Build version format | ||
version: "{build}" | ||
|
||
# What combinations to test | ||
environment: | ||
matrix: | ||
- nodejs_version: 8 | ||
|
||
branches: | ||
only: | ||
- master | ||
|
||
install: | ||
# Get the latest stable version of Node.js | ||
- ps: Install-Product node $env:nodejs_version | ||
# install modules | ||
- npm install | ||
|
||
build: off | ||
|
||
test_script: | ||
- npm test | ||
|
||
matrix: | ||
fast_finish: true # set this flag to immediately finish build once one of the jobs fails. |
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 |
---|---|---|
@@ -1,26 +1,55 @@ | ||
{ | ||
"name": "eslint-plugin", | ||
"version": "0.0.0", | ||
"private": true, | ||
"author": "薛定谔的猫 <weiran.zsd@outlook.com>", | ||
"description": "some eslint plugins", | ||
"dependencies": {}, | ||
"devDependencies": {}, | ||
"scripts": { | ||
"install": "npm run install:autofix && npm run install:no-autofix && npm run install:web", | ||
"install:autofix": "cd packages/autofix && npm i", | ||
"install:no-autofix": "cd packages/no-autofix && npm i", | ||
"install:web": "cd packages/web && npm i", | ||
"test": "npm run test:autofix && npm run test:no-autofix && npm run test:web", | ||
"test:autofix": "cd packages/autofix && npm t", | ||
"test:no-autofix": "cd packages/no-autofix && npm t", | ||
"test:web": "cd packages/web && npm t" | ||
}, | ||
"license": "MIT", | ||
"repository": "https://github.com/aladdin-add/eslint-plugin", | ||
"homepage": "https://github.com/aladdin-add/eslint-plugin", | ||
"bugs": "https://github.com/aladdin-add/eslint-plugin/issues/", | ||
"engines": { | ||
"node": ">=8" | ||
} | ||
} | ||
{ | ||
"name": "eslint-plugin", | ||
"version": "0.0.0", | ||
"private": true, | ||
"author": "薛定谔的猫 <weiran.zsd@outlook.com>", | ||
"description": "some eslint plugins", | ||
"dependencies": {}, | ||
"devDependencies": { | ||
"eslint": "^7.0.0-alpha.0", | ||
"eslint-config-eslint": "^6.0.0", | ||
"eslint-plugin-eslint-plugin": "^2.2.1", | ||
"eslint-plugin-jsdoc": "^21.0.0", | ||
"eslint-plugin-node": "^11.0.0" | ||
}, | ||
"scripts": { | ||
"postinstall": "npm run install:autofix && npm run install:no-autofix && npm run install:web", | ||
"install:autofix": "cd packages/autofix && npm i", | ||
"install:no-autofix": "cd packages/no-autofix && npm i", | ||
"install:web": "cd packages/web && npm i", | ||
"test": "npm run test:autofix && npm run test:no-autofix && npm run test:web", | ||
"test:autofix": "cd packages/autofix && npm t", | ||
"test:no-autofix": "cd packages/no-autofix && npm t", | ||
"test:web": "cd packages/web && npm t", | ||
"lint": "eslint packages/" | ||
}, | ||
"eslintConfig": { | ||
"extends": [ | ||
"eslint-config-eslint", | ||
"plugin:eslint-plugin/recommended" | ||
], | ||
"plugins": [ | ||
"eslint-plugin" | ||
], | ||
"overrides": [ | ||
{ | ||
"files": [ | ||
"packages/*/tests/**/*" | ||
], | ||
"env": { | ||
"mocha": true | ||
} | ||
} | ||
] | ||
}, | ||
"eslintIgnore": [ | ||
"node_modules/" | ||
], | ||
"license": "MIT", | ||
"repository": "https://github.com/aladdin-add/eslint-plugin", | ||
"homepage": "https://github.com/aladdin-add/eslint-plugin", | ||
"bugs": "https://github.com/aladdin-add/eslint-plugin/issues/", | ||
"engines": { | ||
"node": ">=8" | ||
} | ||
} |
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 |
---|---|---|
@@ -1 +1 @@ | ||
package-lock=false | ||
package-lock=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 |
---|---|---|
@@ -1,20 +1,20 @@ | ||
The MIT License (MIT) | ||
|
||
Copyright (c) 2018 薛定谔的猫 | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy of | ||
this software and associated documentation files (the "Software"), to deal in | ||
the Software without restriction, including without limitation the rights to | ||
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of | ||
the Software, and to permit persons to whom the Software is furnished to do so, | ||
subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS | ||
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR | ||
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER | ||
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN | ||
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
The MIT License (MIT) | ||
Copyright (c) 2018 薛定谔的猫 | ||
Permission is hereby granted, free of charge, to any person obtaining a copy of | ||
this software and associated documentation files (the "Software"), to deal in | ||
the Software without restriction, including without limitation the rights to | ||
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of | ||
the Software, and to permit persons to whom the Software is furnished to do so, | ||
subject to the following conditions: | ||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS | ||
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR | ||
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER | ||
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN | ||
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
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 |
---|---|---|
@@ -1,50 +1,49 @@ | ||
/** | ||
* @fileoverview Common utils for AST. (copied from eslint repo) | ||
* @author Gyandeep Singh | ||
*/ | ||
|
||
"use strict"; | ||
|
||
const anyFunctionPattern = /^(?:Function(?:Declaration|Expression)|ArrowFunctionExpression)$/u; | ||
const sideEffectFree = new Set(["Literal", "Identifier", "ThisExpression"]); | ||
|
||
/** | ||
* Finds a function node from ancestors of a node. | ||
* @param {ASTNode} node - A start node to find. | ||
* @returns {Node|null} A found function node. | ||
*/ | ||
function getUpperFunction(node) { | ||
for (let currentNode = node; currentNode; currentNode = currentNode.parent) { | ||
if (anyFunctionPattern.test(currentNode.type)) { | ||
return currentNode; | ||
} | ||
} | ||
return null; | ||
} | ||
|
||
/** | ||
* Check if an expression has side effect. | ||
* | ||
* @param {Node} node AST node | ||
* @returns {boolean} result | ||
*/ | ||
function hasSideEffect(node) { | ||
if (sideEffectFree.has(node.type)) { | ||
return false; | ||
} | ||
|
||
if (node.type === "MemberExpression") { | ||
return hasSideEffect(node.object) || hasSideEffect(node.property); | ||
} | ||
|
||
if (node.type === "TemplateLiteral") { | ||
return node.expressions.length !== 0; | ||
} | ||
|
||
return true; | ||
} | ||
|
||
module.exports = { | ||
getUpperFunction, | ||
hasSideEffect | ||
}; | ||
/** | ||
* @fileoverview Common utils for AST. (copied from eslint repo) | ||
* @author Gyandeep Singh | ||
*/ | ||
|
||
"use strict"; | ||
|
||
const anyFunctionPattern = /^(?:Function(?:Declaration|Expression)|ArrowFunctionExpression)$/u; | ||
const sideEffectFree = new Set(["Literal", "Identifier", "ThisExpression"]); | ||
|
||
/** | ||
* Finds a function node from ancestors of a node. | ||
* @param {ASTNode} node A start node to find. | ||
* @returns {Node|null} A found function node. | ||
*/ | ||
function getUpperFunction(node) { | ||
for (let currentNode = node; currentNode; currentNode = currentNode.parent) { | ||
if (anyFunctionPattern.test(currentNode.type)) { | ||
return currentNode; | ||
} | ||
} | ||
return null; | ||
} | ||
|
||
/** | ||
* Check if an expression has side effect. | ||
* @param {Node} node AST node | ||
* @returns {boolean} result | ||
*/ | ||
function hasSideEffect(node) { | ||
if (sideEffectFree.has(node.type)) { | ||
return false; | ||
} | ||
|
||
if (node.type === "MemberExpression") { | ||
return hasSideEffect(node.object) || hasSideEffect(node.property); | ||
} | ||
|
||
if (node.type === "TemplateLiteral") { | ||
return node.expressions.length !== 0; | ||
} | ||
|
||
return true; | ||
} | ||
|
||
module.exports = { | ||
getUpperFunction, | ||
hasSideEffect | ||
}; |
Oops, something went wrong.