-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from seegno/feature/add-first-version
Add first version
- Loading branch information
Showing
22 changed files
with
848 additions
and
0 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 |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"loose": "all" | ||
} |
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 |
---|---|---|
@@ -0,0 +1 @@ | ||
node_modules |
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 |
---|---|---|
@@ -0,0 +1,74 @@ | ||
additionalRules: [ ./dist/rules/*.js ] | ||
disallowDanglingUnderscores: true | ||
disallowEmptyBlocks: true | ||
disallowGeneratorsInDescribeFunctions: true | ||
disallowKeywords: [ with ] | ||
disallowKeywordsInComments: true | ||
disallowKeywordsOnNewLine: [ catch, else, while ] | ||
disallowMixedSpacesAndTabs: true | ||
disallowMultipleLineBreaks: true | ||
disallowMultipleLineStrings: true | ||
disallowMultipleSpaces: true | ||
disallowMultipleVarDecl: strict | ||
disallowNewlineBeforeBlockStatements: true | ||
disallowNodeTypes: [ LabeledStatement ] | ||
disallowOnlyFilterInTestFunctions: true | ||
disallowOperatorBeforeLineBreak: true | ||
disallowPaddingNewlinesInBlocks: true | ||
disallowQuotedKeysInObjects: true | ||
disallowSpaceAfterObjectKeys: true | ||
disallowSpaceAfterPrefixUnaryOperators: true | ||
disallowSpaceBeforeComma: true | ||
disallowSpaceBeforePostfixUnaryOperators: true | ||
disallowSpaceBeforeSemicolon: true | ||
disallowSpacesInCallExpression: true | ||
disallowSpacesInFunctionDeclaration: { beforeOpeningRoundBrace: true } | ||
disallowSpacesInsideArrayBrackets: true | ||
disallowSpacesInsideParentheses: true | ||
disallowSpacesInsideParenthesizedExpression: true | ||
disallowTrailingComma: true | ||
disallowTrailingWhitespace: true | ||
disallowYodaConditions: true | ||
esnext: true | ||
excludeFiles: [ .git, dist, node_modules ] | ||
requireBlocksOnNewline: 1 | ||
requireCamelCaseOrUpperCaseIdentifiers: true | ||
requireCapitalizedComments: { allExcept: [eslint] } | ||
requireCapitalizedConstructors: true | ||
requireCommaBeforeLineBreak: true | ||
requireCurlyBraces: true | ||
requireDotNotation: true | ||
requireLineBreakAfterVariableAssignment: true | ||
requireLineFeedAtFileEnd: true | ||
requireMatchingFunctionName: true | ||
requirePaddingNewLineAfterVariableDeclaration: true | ||
requirePaddingNewLinesAfterBlocks: { allExcept: ['inCallExpressions', 'inNewExpressions', 'inArrayExpressions', 'inProperties'] } | ||
requirePaddingNewLinesAfterUseStrict: true | ||
requirePaddingNewLinesBeforeExport: true | ||
requirePaddingNewLinesBeforeLineComments: { allExcept: firstAfterCurly } | ||
requirePaddingNewlinesBeforeKeywords: [ case, do, finally, for, function, if, return, switch, try, typeof, void, while, with ] | ||
requireParenthesesAroundIIFE: true | ||
requireSemicolons: true | ||
requireShouldAssertionExecution: true | ||
requireSpaceAfterBinaryOperators: true | ||
requireSpaceAfterComma: true | ||
requireSpaceAfterKeywords: [ case, catch, do, finally, for, if, return, switch, try, typeof, while, with ] | ||
requireSpaceAfterLineComment: true | ||
requireSpaceBeforeBinaryOperators: true | ||
requireSpaceBeforeBlockStatements: true | ||
requireSpaceBeforeKeywords: [ catch, else, while ] | ||
requireSpaceBeforeObjectValues: true | ||
requireSpaceBetweenArguments: true | ||
requireSpacesInAnonymousFunctionExpression: { beforeOpeningCurlyBrace: true } | ||
requireSpacesInConditionalExpression: true | ||
requireSpacesInForStatement: true | ||
requireSpacesInsideObjectBrackets: all | ||
requireSpread: true | ||
requireSqlTemplateInQueryFunction: true | ||
requireTemplateStrings: true | ||
safeContextKeyword: self | ||
validateIndentation: 2 | ||
validateLineBreaks: LF | ||
validateOrderInObjectKeys: asc | ||
validateParameterSeparator: ", " | ||
validateQuoteMarks: "'" |
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 |
---|---|---|
@@ -0,0 +1,6 @@ | ||
language: node_js | ||
|
||
node_js: | ||
- node | ||
|
||
sudo: 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 |
---|---|---|
@@ -0,0 +1 @@ | ||
(c) Copyright 2015 Seegno, Inc. All rights reserved. |
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,3 +1,34 @@ | ||
# jscs-config-seegno | ||
|
||
Seegno-flavored JSCS config. | ||
|
||
## Installation | ||
|
||
```sh | ||
$ npm install jscs jscs-config-seegno --save-dev | ||
``` | ||
|
||
## Usage | ||
|
||
Create an `.jscsrc` file with the following: | ||
|
||
```yaml | ||
plugins: | ||
- 'jscs-config-seegno' | ||
|
||
preset: seegno | ||
``` | ||
Add the following `script` to your `package.json`: | ||
|
||
```json | ||
scripts: { | ||
"lint": "jscs ." | ||
} | ||
``` | ||
|
||
and run the linter with: | ||
|
||
```sh | ||
$ npm run lint | ||
``` |
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 |
---|---|---|
@@ -0,0 +1,35 @@ | ||
'use strict'; | ||
|
||
/** | ||
* Module dependencies. | ||
*/ | ||
|
||
exports.__esModule = true; | ||
|
||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } | ||
|
||
var _jscsLibCliConfig = require('jscs/lib/cli-config'); | ||
|
||
var _jscsLibCliConfig2 = _interopRequireDefault(_jscsLibCliConfig); | ||
|
||
var _path = require('path'); | ||
|
||
var _path2 = _interopRequireDefault(_path); | ||
|
||
/** | ||
* Instances. | ||
*/ | ||
|
||
var dir = _path2['default'].join(__dirname, '..'); | ||
var config = _jscsLibCliConfig2['default'].load('.jscsrc', dir); | ||
|
||
/** | ||
* Export custom configuration. | ||
*/ | ||
|
||
function register(conf) { | ||
conf.registerPreset('seegno', config); | ||
} | ||
|
||
exports['default'] = register; | ||
module.exports = exports['default']; |
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 |
---|---|---|
@@ -0,0 +1,46 @@ | ||
'use strict'; | ||
|
||
/** | ||
* Module dependencies. | ||
*/ | ||
|
||
exports.__esModule = true; | ||
|
||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } | ||
|
||
var _assert = require('assert'); | ||
|
||
var _assert2 = _interopRequireDefault(_assert); | ||
|
||
/** | ||
* Export `disallowGeneratorsInDescribeFunctions`. | ||
*/ | ||
|
||
var disallowGeneratorsInDescribeFunctions = function disallowGeneratorsInDescribeFunctions() {}; | ||
|
||
disallowGeneratorsInDescribeFunctions.prototype = { | ||
check: function check(file, errors) { | ||
file.iterateNodesByType('CallExpression', function (node) { | ||
if (node.callee.name !== 'describe') { | ||
return; | ||
} | ||
|
||
node.arguments.filter(function (argument) { | ||
return argument.type === 'FunctionExpression' && argument.generator === true; | ||
}).forEach(function (argument) { | ||
errors.add('Do not use generators in describe functions', argument.loc.start); | ||
}); | ||
}); | ||
}, | ||
|
||
configure: function configure(disallowGeneratorsInDescribeFunctions) { | ||
_assert2['default'](disallowGeneratorsInDescribeFunctions === true || disallowGeneratorsInDescribeFunctions === false, 'disallowGeneratorsInDescribeFunctions must be a boolean'); | ||
}, | ||
|
||
getOptionName: function getOptionName() { | ||
return 'disallowGeneratorsInDescribeFunctions'; | ||
} | ||
}; | ||
|
||
exports['default'] = disallowGeneratorsInDescribeFunctions; | ||
module.exports = exports['default']; |
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 |
---|---|---|
@@ -0,0 +1,42 @@ | ||
'use strict'; | ||
|
||
/** | ||
* Module dependencies. | ||
*/ | ||
|
||
exports.__esModule = true; | ||
|
||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } | ||
|
||
var _assert = require('assert'); | ||
|
||
var _assert2 = _interopRequireDefault(_assert); | ||
|
||
/** | ||
* Export `disallowOnlyFilterInTestFunctions`. | ||
*/ | ||
|
||
var disallowOnlyFilterInTestFunctions = function disallowOnlyFilterInTestFunctions() {}; | ||
|
||
disallowOnlyFilterInTestFunctions.prototype = { | ||
check: function check(file, errors) { | ||
file.iterateNodesByType('MemberExpression', function (node) { | ||
if (node.property.name !== 'only' && (node.object.name !== 'describe' || node.object.name !== 'it')) { | ||
return; | ||
} | ||
|
||
errors.add('Do not use `.only` in `' + node.object.name + '` functions', node.property.loc.start); | ||
}); | ||
}, | ||
|
||
configure: function configure(disallowOnlyFilterInTestFunctions) { | ||
_assert2['default'](disallowOnlyFilterInTestFunctions === true || disallowOnlyFilterInTestFunctions === false, 'disallowOnlyFilterInTestFunctions must be a boolean'); | ||
}, | ||
|
||
getOptionName: function getOptionName() { | ||
return 'disallowOnlyFilterInTestFunctions'; | ||
} | ||
}; | ||
|
||
exports['default'] = disallowOnlyFilterInTestFunctions; | ||
module.exports = exports['default']; |
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 |
---|---|---|
@@ -0,0 +1,73 @@ | ||
'use strict'; | ||
|
||
/** | ||
* Module dependencies. | ||
*/ | ||
|
||
exports.__esModule = true; | ||
|
||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } | ||
|
||
var _assert = require('assert'); | ||
|
||
var _assert2 = _interopRequireDefault(_assert); | ||
|
||
var _should = require('should'); | ||
|
||
var _should2 = _interopRequireDefault(_should); | ||
|
||
/** | ||
* Auxiliary constants. | ||
*/ | ||
|
||
var Assertion = _should2['default'].Assertion.prototype; | ||
var assertions = Object.keys(Assertion); | ||
var chains = Object.keys(Assertion).filter(function (key) { | ||
return typeof Assertion[key] !== 'function'; | ||
}); | ||
|
||
/** | ||
* Export `requireShouldAssertionExecution`. | ||
*/ | ||
|
||
var requireShouldAssertionExecution = function requireShouldAssertionExecution() {}; | ||
|
||
requireShouldAssertionExecution.prototype = { | ||
check: function check(file, errors) { | ||
file.iterateNodesByType('Identifier', function (node) { | ||
if (!node.parentNode || !node.parentNode.object || !node.parentNode.object.property) { | ||
return; | ||
} | ||
|
||
// Skip non-assertions. | ||
if (assertions.indexOf(node.name) === -1) { | ||
return; | ||
} | ||
|
||
// Skip assertion terms that are used in another conditions. | ||
if (chains.indexOf(node.parentNode.object.property.name) === -1) { | ||
return; | ||
} | ||
|
||
// Allow chaining. | ||
if (chains.indexOf(node.name) !== -1 && chains.indexOf(node.parentNode.object.property.name) !== -1) { | ||
return; | ||
} | ||
|
||
if (node.parentNode.parentNode.type !== 'CallExpression') { | ||
errors.add('You must invoke the assertion in `should.' + node.name + '`', node.loc.end); | ||
} | ||
}); | ||
}, | ||
|
||
configure: function configure(requireShouldAssertionExecution) { | ||
_assert2['default'](requireShouldAssertionExecution === true || requireShouldAssertionExecution === false, 'requireShouldAssertionExecution must be a boolean'); | ||
}, | ||
|
||
getOptionName: function getOptionName() { | ||
return 'requireShouldAssertionExecution'; | ||
} | ||
}; | ||
|
||
exports['default'] = requireShouldAssertionExecution; | ||
module.exports = exports['default']; |
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 |
---|---|---|
@@ -0,0 +1,48 @@ | ||
'use strict'; | ||
|
||
/** | ||
* Module dependencies. | ||
*/ | ||
|
||
exports.__esModule = true; | ||
|
||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } | ||
|
||
var _assert = require('assert'); | ||
|
||
var _assert2 = _interopRequireDefault(_assert); | ||
|
||
/** | ||
* Export `requireSqlTemplateInQueryFunction`. | ||
*/ | ||
|
||
var requireSqlTemplateInQueryFunction = function requireSqlTemplateInQueryFunction() {}; | ||
|
||
requireSqlTemplateInQueryFunction.prototype = { | ||
check: function check(file, errors) { | ||
file.iterateNodesByType('CallExpression', function (node) { | ||
var property = node.callee.property; | ||
|
||
if (!property || property.name !== 'query') { | ||
return; | ||
} | ||
|
||
node.arguments.forEach(function (argument) { | ||
if (argument.type !== 'TaggedTemplateExpression') { | ||
errors.add('Use the `sql` tagged template literal for raw queries', argument.loc.start); | ||
} | ||
}); | ||
}); | ||
}, | ||
|
||
configure: function configure(requireSqlTemplate) { | ||
_assert2['default'](requireSqlTemplate === true || requireSqlTemplate === false, 'requireSqlTemplate option requires sql tagged templates on raw queries'); | ||
}, | ||
|
||
getOptionName: function getOptionName() { | ||
return 'requireSqlTemplateInQueryFunction'; | ||
} | ||
}; | ||
|
||
exports['default'] = requireSqlTemplateInQueryFunction; | ||
module.exports = exports['default']; |
Oops, something went wrong.