refactor(lint): remove jscs, update eslint rules (#477), r=@vbudhram

This commit is contained in:
Vlad Filippov 2017-08-31 11:06:34 -04:00 коммит произвёл Vijay Budhram
Родитель 176c8285fc
Коммит 8bc148ab33
36 изменённых файлов: 1186 добавлений и 1410 удалений

Просмотреть файл

@ -1,11 +1,7 @@
{
"extends": "fxa/server",
"env": {
"mocha": true
},
"rules": {
"handle-callback-err": 0,
"complexity": [2, 10],
"semi": [2, "always"]
}
}
plugins:
- fxa
extends: plugin:fxa/server
rules:
handle-callback-err: 0
semi: [2, "always"]

19
.jscsrc
Просмотреть файл

@ -1,19 +0,0 @@
{
"disallowKeywords": ["with", "eval"],
"disallowKeywordsOnNewLine": ["else"],
"disallowMultipleLineStrings": true,
"disallowSpaceAfterObjectKeys": true,
"disallowSpaceAfterPrefixUnaryOperators": ["++", "--", "+", "-"],
"disallowSpaceBeforePostfixUnaryOperators": ["++", "--"],
"maximumLineLength": 160,
"requireCapitalizedConstructors": true,
"requireCurlyBraces": ["for", "while", "do"],
"requireLineFeedAtFileEnd": true,
"requireSpaceAfterKeywords": ["if", "else", "for", "while", "do", "switch", "return"],
"requireSpaceAfterBinaryOperators": ["=", ",", "+", "-", "/", "*", "==", "===", "!=", "!=="],
"requireSpaceAfterPrefixUnaryOperators": ["~"],
"requireSpacesInConditionalExpression": true,
"requireSpaceBeforeBinaryOperators": ["+", "-", "/", "*", "=", "==", "===", "!=", "!=="],
"validateIndentation": 2,
"validateQuoteMarks": "'"
}

Просмотреть файл

@ -1,5 +1,7 @@
FROM node:6.11.1-alpine
RUN apk add --no-cache git
RUN addgroup -g 10001 app && \
adduser -D -G app -h /app -u 10001 app
WORKDIR /app

Просмотреть файл

@ -1,16 +0,0 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
module.exports = function (grunt) {
'use strict';
grunt.config('jscs', {
app: [
'<%= mainJsFiles %>'
],
options: {
config: '.jscsrc'
}
});
};

Просмотреть файл

@ -8,7 +8,6 @@ module.exports = function (grunt) {
'use strict';
grunt.registerTask('lint', [
'eslint',
'jscs'
'eslint'
]);
};

Просмотреть файл

@ -7,7 +7,7 @@ const crypto = require('crypto');
const config = require('./config');
function unique(length) {
return crypto.randomBytes(length);
return crypto.randomBytes(length); // eslint-disable-line fxa/async-crypto-random
}
function fn(configName) {

2295
npm-shrinkwrap.json сгенерированный

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Просмотреть файл

@ -43,13 +43,12 @@
"urijs": "^1.16.1"
},
"devDependencies": {
"eslint-config-fxa": "^1.8.0",
"eslint-plugin-fxa": "git://github.com/mozilla/eslint-plugin-fxa.git#41504c9dd30e8b52900c15b524946aa0428aef95",
"grunt": "^1.0.1",
"grunt-bump": "0.8.0",
"grunt-conventional-changelog": "^1.1.0",
"grunt-copyright": "^0.3.0",
"grunt-eslint": "^16.0.0",
"grunt-jscs": "^3.0.1",
"grunt-eslint": "18.0.0",
"grunt-nodemon": "^0.4.0",
"grunt-nsp": "2.3.1",
"insist": "1.x",

8
scripts/.eslintrc Normal file
Просмотреть файл

@ -0,0 +1,8 @@
plugins:
- fxa
rules:
fxa/async-crypto-random: 0
fxa/no-new-buffer: 2
no-console: 0
handle-callback-err: 0

Просмотреть файл

@ -5,7 +5,7 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
if (process.argv.length !== 4) {
console.error(`Usage: node generate-client-for-ops.js "client-name" "client-redirect-url"`);
console.error('Usage: node generate-client-for-ops.js "client-name" "client-redirect-url"');
process.exit(1);
}

10
test/.eslintrc Normal file
Просмотреть файл

@ -0,0 +1,10 @@
plugins:
- fxa
extends: ../.eslintrc
env:
mocha: true
rules:
fxa/async-crypto-random: 0
fxa/no-new-buffer: 2

Просмотреть файл

@ -9,7 +9,7 @@ describe('util', function () {
describe('base64URLEncode', function () {
it('properly encodes', function () {
var testBase64 = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/',
testBuffer = new Buffer(testBase64, 'base64'),
testBuffer = Buffer.from(testBase64, 'base64'),
expectedBase64 = testBase64.replace('+', '-').replace('/', '_');
assert.equal(util.base64URLEncode(testBuffer), expectedBase64);