Skip to content
Permalink
Browse files

Add top-level eslint config to support overrides for benchmarks, test…

…s, and examples
  • Loading branch information...
Planeshifter committed Aug 5, 2018
1 parent b0946a1 commit 3c1ea7e6cb38508f0263528532ca727ea5991418
@@ -0,0 +1,28 @@
/**
* @license Apache-2.0
*
* Copyright (c) 2018 The Stdlib Authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

'use strict';

// MODULES //

var eslint = require( './etc/eslint/.eslintrc.overrides.js' );


// EXPORTS //

module.exports = eslint;
@@ -62,7 +62,7 @@ eslint.rules = require( './rules' );
* @memberof eslint
* @type {Array}
*/
eslint.overrides = require( './overrides' );
eslint.overrides = require( './overrides/repl_namespace.js' );

/**
* Parser options.
@@ -0,0 +1,51 @@
/**
* @license Apache-2.0
*
* Copyright (c) 2018 The Stdlib Authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

'use strict';

// MODULES //

// FIXME: remove the next line and uncomment the subsequent line once all remark JSDoc ESLint rules are completed
var copy = require( './../../lib/node_modules/@stdlib/utils/copy' );

// var copy = require( './utils/copy.js' );
var defaults = require( './.eslintrc.js' );


// MAIN //

/**
* ESLint configuration.
*
* @namespace eslint
*/
var eslint = copy( defaults );

/**
* Overrides.
*
* @name overrides
* @memberof eslint
* @type {Array}
*/
eslint.overrides = require( './overrides' );


// EXPORTS //

module.exports = eslint;
@@ -18,6 +18,48 @@

'use strict';

// VARIABLES //

var restrictedSyntaxConfig = [ 'error',
'ArrowFunctionExpression',
'ClassBody',
'ClassDeclaration',
'ClassExpression',
'DebuggerStatement',
'ExperimentalRestProperty',
'ExperimentalSpreadProperty',

// 'FunctionExpression',
'LabeledStatement',
'RestElement',
'SpreadElement',
'TaggedTemplateExpression',
'TemplateElement',
'TemplateLiteral',
'WithStatement',
'YieldExpression',
'JSXIdentifier',
'JSXNamespacedName',
'JSXMemberExpression',
'JSXEmptyExpression',
'JSXExpressionContainer',
'JSXElement',
'JSXClosingElement',
'JSXOpeningElement',
'JSXAttribute',
'JSXSpreadAttribute',
'JSXText',
'ExportDefaultDeclaration',
'ExportNamedDeclaration',
'ExportAllDeclaration',
'ExportSpecifier',
'ImportDeclaration',
'ImportSpecifier',
'ImportDefaultSpecifier',
'ImportNamespaceSpecifier'
];


// MAIN //

/**
@@ -27,11 +69,51 @@
*/
var overrides = [
{
'env': {},
'files': [ '[a-z].js' ],
'rules': {
'stdlib/repl-namespace-order': 'error'
}
},
{
'files': [ '**/benchmark/*.js' ],
'rules': {
'no-new-wrappers': 'warn',
'max-lines': [ 'warn', {
'max': 1000,
'skipBlankLines': true,
'skipComments': true
}],
'no-restricted-syntax': restrictedSyntaxConfig,
'require-jsdoc': 'off',
'stdlib/jsdoc-private-annotation': 'off'
}
},
{
'files': [ '**/examples/*.js' ],
'rules': {
'no-new-wrappers': 'warn',
'vars-on-top': 'off',
'no-console': 'off',
'require-jsdoc': 'off',
'stdlib/jsdoc-private-annotation': 'off',
'stdlib/vars-order': 'off'
}
},
{
'files': [ '**/test/*.js' ],
'rules': {
'no-empty-function': 'off',
'no-new-wrappers': 'warn',
'max-lines': [ 'warn', {
'max': 1000,
'skipBlankLines': true,
'skipComments': true
}],
'no-restricted-syntax': restrictedSyntaxConfig,
'require-jsdoc': 'off',
'stdlib/jsdoc-private-annotation': 'off',
'no-undefined': 'off'
}
}
];

@@ -0,0 +1,40 @@
/**
* @license Apache-2.0
*
* Copyright (c) 2018 The Stdlib Authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

'use strict';

// MAIN //

/**
* ESLint overrides for REPL namespace files.
*
* @namespace overrides
*/
var overrides = [
{
'files': [ '[a-z].js' ],
'rules': {
'stdlib/repl-namespace-order': 'error'
}
}
];


// EXPORTS //

module.exports = overrides;

0 comments on commit 3c1ea7e

Please sign in to comment.
You can’t perform that action at this time.