eslint-config-pv
Advanced tools
Comparing version 1.0.10 to 2.0.0
@@ -81,3 +81,3 @@ /* eslint-disable strict */ | ||
dealerName, | ||
startPoint | ||
startPoint, | ||
} | ||
@@ -95,2 +95,14 @@ }); | ||
const invalidES5 = ` | ||
function test() { | ||
var a = [ | ||
1, | ||
2, | ||
]; | ||
a.push(arguments.callee); | ||
var b = {}; | ||
b.__defineGetter__('tom', test); | ||
} | ||
`; | ||
describe("flags no warnings with valid js", () => { | ||
@@ -101,10 +113,4 @@ let cli, result; | ||
cli = new CLIEngine({ | ||
extends: ["../es6.js"], | ||
env: { | ||
"es6": true, | ||
"browser": true | ||
}, | ||
"parserOptions": { | ||
"sourceType": "module" | ||
} | ||
useEslintrc: false, | ||
configFile: "__tests__/.eslintrc-index" | ||
}); | ||
@@ -124,2 +130,23 @@ }); | ||
describe("handles legacy JS", () => { | ||
let cli, result; | ||
beforeEach(() => { | ||
cli = new CLIEngine({ | ||
useEslintrc: false, | ||
configFile: "__tests__/.eslintrc-legacy" | ||
}); | ||
}); | ||
it("doesn't parse ES6", () => { | ||
result = cli.executeOnText(validJS).results[0]; | ||
expect(result.errorCount).toBe(1); | ||
}); | ||
it("follows legacy rules", () => { | ||
result = cli.executeOnText(invalidES5).results[0]; | ||
expect(result.errorCount).toBe(7); | ||
}); | ||
}); | ||
describe("flags warnings with invalid js", () => { | ||
@@ -130,10 +157,4 @@ let cli, result; | ||
cli = new CLIEngine({ | ||
extends: ["../es6.js"], | ||
env: { | ||
"es6": true, | ||
"browser": true | ||
}, | ||
"parserOptions": { | ||
"sourceType": "module" | ||
} | ||
useEslintrc: false, | ||
configFile: "__tests__/.eslintrc-index" | ||
}); | ||
@@ -166,27 +187,2 @@ }); | ||
}); | ||
it("did warn", () => { | ||
result = cli.executeOnText(invalidJS).results[0]; | ||
expect(result.warningCount).toBe(1); | ||
}); | ||
it("correct warning text", () => { | ||
result = cli.executeOnText(invalidJS).results[0]; | ||
expect(result.messages[1].message).toBe("'something' is not defined."); | ||
}); | ||
it("correct warning rule", () => { | ||
result = cli.executeOnText(invalidJS).results[0]; | ||
expect(result.messages[1].ruleId).toBe("no-undef"); | ||
}); | ||
it("correct line number for warning", () => { | ||
result = cli.executeOnText(invalidJS).results[0]; | ||
expect(result.messages[1].line).toBe(3); | ||
}); | ||
it("correct severity for warning", () => { | ||
result = cli.executeOnText(invalidJS).results[0]; | ||
expect(result.messages[1].severity).toBe(1); | ||
}); | ||
}); |
@@ -0,16 +1,49 @@ | ||
# 2.0.0 | ||
- Changed: Compatible with eslint 4.6.1 | ||
- Changed: added `"array-bracket-newline": ["error", { "multiline": false, "minItems": 2 }]` | ||
- Changed: added `"array-element-newline": ["off"]` | ||
- Changed: added `"capitalized-comments": ["off"]` | ||
- Changed: added `"class-methods-use-this": ["off"]` | ||
- Changed: added `"for-direction": ["error"]` | ||
- Changed: added `"func-call-spacing": ["error", "never"]` | ||
- Changed: added `"func-name-matching": ["off"]` | ||
- Changed: added `"indent": ["error", 2, { "SwitchCase": 1 }]` | ||
- Changed: added `"line-comment-position": ["off"]` | ||
- Changed: added `"linebreak-style": ["error", "unix"]` | ||
- Changed: added `"multiline-ternary": ["error", "always-multiline"]` | ||
- Changed: added `"newline-before-return": ["off"]` | ||
- Changed: added `"no-mixed-operators": ["error"]` | ||
- Changed: added `"no-restricted-globals": ["error", "event"]` | ||
- Changed: added `"no-shadow": ["error", { "hoist": "functions" }]` | ||
- Changed: added `"no-warning-comments": ["error", { "terms": ["todo", "fixme", "hack", "hacky"], "location": "start" }]` | ||
- Changed: added `"object-curly-newline": ["off"]` | ||
- Changed: added `"padding-line-between-statements": ["off"]` | ||
- Changed: added `"prefer-destructuring": ["off"]` | ||
- Changed: added `"prefer-promise-reject-errors": ["off"]` | ||
- Changed: added `"require-jsdoc": ["off"]` | ||
- Changed: added `"rest-spread-spacing": ["error", "never"]` | ||
- Changed: added `"semi-style": ["error", "last"]` | ||
- Changed: added `"symbol-description": ["error"]` | ||
- Changed: added `"template-tag-spacing": ["error", "never"]` | ||
- Changed: added `"unicode-bom": ["error", "never"]` | ||
- Changed: added `"getter-return": ["error"]` | ||
- Changed: added `"function-paren-newline": ["off"]` | ||
# 1.0.10 | ||
- Changed: curly to ["error", "multi-line", "consistent"] | ||
- Changed: curly to: "error", "multi-line", "consistent" | ||
# 1.0.9 | ||
[Skipped because of publishing issues] | ||
(Skipped because of publishing issues)) | ||
# 1.0.8 | ||
[Skipped because of publishing issues] | ||
(Skipped because of publishing issues) | ||
# 1.0.7 | ||
- Updated: license | ||
- Updated: license | ||
@@ -28,4 +61,4 @@ # 1.0.6 | ||
- Changed: no-magic-numbers to 0 | ||
- Changed: object-property-newline: [2, { "allowMultiplePropertiesPerLine": true }] | ||
- Changed: quote-props: [2, "as-needed", { "keywords": true, "unnecessary": true }] | ||
- Changed: object-property-newline: (2, { "allowMultiplePropertiesPerLine": true }) | ||
- Changed: quote-props: (2, "as-needed", { "keywords": true, "unnecessary": true }) | ||
- Changed: merged all rules into fewer files | ||
@@ -32,0 +65,0 @@ |
module.exports = { | ||
extends: [ | ||
"./rules/legacy", | ||
"./rules/node", | ||
"./rules/4-0", | ||
"./rules/4-2", | ||
"./rules/4-6", | ||
].map(require.resolve), | ||
env: { | ||
"browser": true, | ||
"jasmine": true, | ||
"node": true | ||
browser: true, | ||
node: false, | ||
amd: false, | ||
mocha: false, | ||
jasmine: false | ||
}, | ||
ecmaFeatures: {}, | ||
globals: {}, | ||
rules: {} | ||
rules: { | ||
"comma-dangle": ["error", "never"], | ||
"vars-on-top": "error", | ||
"no-restricted-properties": ["error", { | ||
object: "arguments", | ||
property: "callee", | ||
message: "arguments.callee is deprecated", | ||
}, { | ||
property: "__defineGetter__", | ||
message: "Please use Object.defineProperty instead.", | ||
}, { | ||
property: "__defineSetter__", | ||
message: "Please use Object.defineProperty instead.", | ||
}] | ||
} | ||
}; |
{ | ||
"name": "eslint-config-pv", | ||
"version": "1.0.10", | ||
"version": "2.0.0", | ||
"description": "pro!vision ESLint configuration. Can be adapted and adjusted in each project.", | ||
@@ -23,2 +23,7 @@ "author": { | ||
], | ||
"remarkConfig": { | ||
"plugins": [ | ||
"remark-preset-lint-recommended" | ||
] | ||
}, | ||
"preferGlobal": false, | ||
@@ -50,13 +55,13 @@ "homepage": "https://github.com/pro-vision/eslint-config-pv", | ||
"devDependencies": { | ||
"eslint": "3.12.2", | ||
"eslint-plugin-import": "2.2.0", | ||
"eslint": "4.6.1", | ||
"eslint-plugin-import": "2.7.0", | ||
"github-release-from-changelog": "1.2.1", | ||
"jest": "18.0.0", | ||
"npm-run-all": "3.1.2", | ||
"jest": "21.0.1", | ||
"npm-run-all": "4.1.1", | ||
"npmpub": "3.1.0", | ||
"remark-cli": "2.1.0", | ||
"remark-lint": "5.4.0", | ||
"remark-preset-lint-recommended": "1.0.0" | ||
"remark-cli": "4.0.0", | ||
"remark-lint": "6.0.1", | ||
"remark-preset-lint-recommended": "3.0.1" | ||
}, | ||
"dependencies": {} | ||
} |
@@ -7,6 +7,11 @@ # eslint-config-pv | ||
## Versions | ||
This is version >= 2.0.0 of eslint-config-pv, which is compatible with eslint >= 4.0.0. I you are using eslint 3, use eslint-config-pv 1.0.10 | ||
## Installation | ||
```bash | ||
npm install --save-dev eslint-config-pv | ||
# for the eslint 3 compatible version | ||
npm install --save-dev eslint-config-pv@1.0.10 | ||
``` | ||
@@ -19,2 +24,3 @@ | ||
### eslint-config-pv | ||
@@ -71,2 +77,2 @@ | ||
Alternatively, you can define `.eslintignore` [as described here](http://eslint.org/docs/user-guide/configuring#ignoring-files-and-directories). | ||
Alternatively, you can define `.eslintignore` [as described here](http://eslint.org/docs/user-guide/configuring#ignoring-files-and-directories). |
140
rules/es6.js
@@ -5,78 +5,104 @@ module.exports = { | ||
}, | ||
"ecmaFeatures": { | ||
"arrowFunctions": true, | ||
"binaryLiterals": false, | ||
"blockBindings": true, | ||
"classes": true, | ||
"defaultParams": true, | ||
"destructuring": true, | ||
"forOf": true, | ||
"generators": true, | ||
"modules": true, | ||
"objectLiteralComputedProperties": true, | ||
"objectLiteralDuplicateProperties": false, | ||
"objectLiteralShorthandMethods": true, | ||
"objectLiteralShorthandProperties": true, | ||
"octalLiterals": false, | ||
"regexUFlag": false, | ||
"regexYFlag": false, | ||
"restParams": true, | ||
"spread": true, | ||
"superInFunctions": false, | ||
"templateStrings": true, | ||
"unicodeCodePointEscapes": false, | ||
"globalReturn": false, | ||
"jsx": false | ||
}, | ||
"rules": { | ||
// 4.0.0 | ||
// enforces no braces where they can be omitted | ||
// http://eslint.org/docs/rules/arrow-body-style | ||
"arrow-body-style": [2, "as-needed"], | ||
"arrow-body-style": ["error", "as-needed"], | ||
// require parens in arrow function arguments | ||
"arrow-parens": [1, "always"], | ||
"arrow-parens": ["error", "as-needed"], | ||
// require space before/after arrow function"s arrow | ||
// https://github.com/eslint/eslint/blob/master/docs/rules/arrow-spacing.md | ||
"arrow-spacing": [2, { | ||
"before": true, | ||
"after": true | ||
}], | ||
"arrow-spacing": ["error", { "before": true, "after": true }], | ||
// if a class method does not use this, it can safely be made a static function | ||
"class-methods-use-this": ["off"], | ||
// verify super() callings in constructors | ||
"constructor-super": 2, | ||
"constructor-super": ["error"], | ||
// enforce the spacing around the * in generator functions | ||
"generator-star-spacing": 0, | ||
// disallow modifying variables of class declarations | ||
"no-class-assign": 2, | ||
"generator-star-spacing": ["off"], | ||
// Disallow await inside of loops | ||
"no-await-in-loop": ["error"], | ||
// Disallow modifying variables of class declarations | ||
"no-class-assign": ["error"], | ||
// disallow modifying variables that are declared using const | ||
"no-const-assign": 2, | ||
"no-const-assign": ["error"], | ||
// Disallow duplicate name in class members | ||
// https://github.com/eslint/eslint/blob/master/docs/rules/no-dupe-class-members.md | ||
"no-dupe-class-members": 2, | ||
"no-dupe-class-members": ["error"], | ||
// Disallow empty destructuring patterns | ||
// https://github.com/eslint/eslint/blob/master/docs/rules/no-empty-pattern.md | ||
"no-empty-pattern": 2, | ||
"no-empty-pattern": ["error"], | ||
// Disallow template literal placeholder syntax in regular strings | ||
"no-template-curly-in-string": ["error"], | ||
// disallow to use this/super before super() calling in constructors. | ||
"no-this-before-super": 2, | ||
"no-this-before-super": ["error"], | ||
// require let or const instead of var | ||
"no-var": 2, | ||
"no-var": ["error"], | ||
// Disallow renaming import, export, and destructured assignments to the same name | ||
"no-useless-rename": ["error"], | ||
// require method and property shorthand syntax for object literals | ||
// https://github.com/eslint/eslint/blob/master/docs/rules/object-shorthand.md | ||
"object-shorthand": [1, "always"], | ||
"object-shorthand": ["error", "always"], | ||
// suggest using arrow functions as callbacks | ||
"prefer-arrow-callback": 2, | ||
"prefer-arrow-callback": ["error"], | ||
// suggest using of const declaration for variables that are never modified after declared | ||
"prefer-const": 2, | ||
"prefer-const": ["error"], | ||
// Prefer destructuring from arrays and objects | ||
"prefer-destructuring": ["off"], | ||
// require using Error objects as Promise rejection reasons | ||
"prefer-promise-reject-errors": ["off"], | ||
// suggest using Reflect methods where applicable | ||
"prefer-reflect": ["off"], | ||
// flag usage of arguments variables | ||
"prefer-rest-params": ["error"], | ||
// suggest using the spread operator instead of .apply() | ||
"prefer-spread": 1, | ||
// suggest using Reflect methods where applicable | ||
"prefer-reflect": 0, | ||
"prefer-spread": ["error"], | ||
// suggest using template literals instead of string concatenation | ||
// http://eslint.org/docs/rules/prefer-template | ||
"prefer-template": 2, | ||
"prefer-template": ["error"], | ||
// Disallow async functions which have no await expression | ||
"require-await": ["error"], | ||
// disallow generator functions that do not have yield | ||
"require-yield": 2, | ||
// flag usage of arguments variables | ||
"prefer-rest-params": 2, | ||
"require-yield": ["error"], | ||
// Enforce spacing between rest and spread operators and their expressions | ||
"rest-spread-spacing": ["error", "never"], | ||
// babel inserts `"use strict";` for us | ||
"strict": [2, "never"] | ||
"strict": ["error", "never"], | ||
// require symbol description | ||
"symbol-description": ["error"], | ||
// maintain consistency around the spacing inside of template literals | ||
"template-curly-spacing": ["error", "never"], | ||
// Require or disallow spacing between template tags and their literals | ||
"template-tag-spacing": ["error", "never"], | ||
// requires to declare all vars on top of their containing scope | ||
"vars-on-top": ["off"], | ||
// spacing consistency for generators | ||
"yield-star-spacing": ["error", { "before": false, "after": true }], | ||
} | ||
}; |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
48621
17
723
76
1