Skip to content

Commit

Permalink
Chore(*): restruct repo
Browse files Browse the repository at this point in the history
  • Loading branch information
aladdin-add committed Feb 13, 2020
1 parent fa05b8d commit faf1ebc
Show file tree
Hide file tree
Showing 67 changed files with 4,468 additions and 4,543 deletions.
18 changes: 9 additions & 9 deletions .editorconfig
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 .github/ISSUE_TEMPLATE/bug-report--eslint-plugin-autofix.md
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 .github/ISSUE_TEMPLATE/bug-report--eslint-plugin-no-autofix.md
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**
20 changes: 10 additions & 10 deletions .gitignore
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
2 changes: 1 addition & 1 deletion .npmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
package-lock=false
package-lock=false
56 changes: 28 additions & 28 deletions appveyor.yml
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.
81 changes: 55 additions & 26 deletions package.json
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"
}
}
2 changes: 1 addition & 1 deletion packages/autofix/.npmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
package-lock=false
package-lock=false
40 changes: 20 additions & 20 deletions packages/autofix/LICENSE
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.
99 changes: 49 additions & 50 deletions packages/autofix/lib/ast-utils.js
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
};
Loading

0 comments on commit faf1ebc

Please sign in to comment.