Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🏗🚮 Simplify the way gulp lint works on Travis #22294

Merged
merged 2 commits into from
May 14, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
"amphtml-internal/no-export-side-effect": 2,
"amphtml-internal/no-for-of-statement": 2,
"amphtml-internal/no-global": 0,
"amphtml-internal/no-has-own-property-method": 1,
"amphtml-internal/no-has-own-property-method": 2,
"amphtml-internal/no-import": 2,
"amphtml-internal/no-import-rename": 2,
"amphtml-internal/no-is-amp-alt": 2,
Expand All @@ -70,12 +70,12 @@
"amphtml-internal/no-style-display": 2,
"amphtml-internal/no-style-property-setting": 2,
"amphtml-internal/no-swallow-return-from-allow-console-error": 2,
"amphtml-internal/prefer-deferred-promise": 1,
"amphtml-internal/prefer-deferred-promise": 0,
"amphtml-internal/prefer-destructuring": 2,
"amphtml-internal/query-selector": 2,
"amphtml-internal/todo-format": 0,
"amphtml-internal/unused-private-field": 1,
"amphtml-internal/vsync": 1,
"amphtml-internal/unused-private-field": 0,
"amphtml-internal/vsync": 0,
"array-bracket-spacing": [2, "never"],
"arrow-parens": [2, "as-needed"],
"arrow-spacing": 2,
Expand Down
20 changes: 2 additions & 18 deletions build-system/tasks/lint.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,14 @@ const log = require('fancy-log');
const path = require('path');
const watch = require('gulp-watch');
const {gitDiffNameOnlyMaster} = require('../git');
const {isTravisBuild, isTravisPullRequestBuild} = require('../travis');
const {isTravisBuild} = require('../travis');
const {maybeUpdatePackages} = require('./update-packages');

const isWatching = (argv.watch || argv.w) || false;
const options = {
fix: false,
quiet: argv.quiet || false,
};
let collapseLintResults = isTravisBuild();

const rootDir = path.dirname(path.dirname(__dirname));

Expand Down Expand Up @@ -79,11 +78,6 @@ function runLinter(filePath, stream, options) {
if (!isTravisBuild()) {
log(colors.green('Starting linter...'));
}
if (collapseLintResults) {
// TODO(#15255, #14761): Remove log folding after warnings are fixed.
log(colors.bold(colors.yellow('Lint results: ')) + 'Expand this section');
console./* OK*/log('travis_fold:start:lint_results\n');
}
const fixedFiles = {};
return stream.pipe(eslint(options))
.pipe(eslint.formatEach('stylish', function(msg) {
Expand All @@ -103,10 +97,6 @@ function runLinter(filePath, stream, options) {
}
}))
.pipe(eslint.results(function(results) {
// TODO(#15255, #14761): Remove log folding after warnings are fixed.
if (collapseLintResults) {
console./* OK*/log('travis_fold:end:lint_results');
}
if (results.errorCount == 0 && results.warningCount == 0) {
if (!isTravisBuild()) {
logOnSameLine(colors.green('SUCCESS: ') +
Expand Down Expand Up @@ -157,9 +147,6 @@ function jsFilesChanged() {
* @return {boolean}
*/
function eslintRulesChanged() {
if (!isTravisPullRequestBuild()) {
return false;
}
return gitDiffNameOnlyMaster().filter(function(file) {
return path.basename(file).includes('.eslintrc') ||
path.dirname(file) === 'build-system/eslint-rules';
Expand All @@ -180,7 +167,6 @@ function setFilesToLint(files) {
log(colors.cyan(file));
});
}
collapseLintResults = false;
}

/**
Expand All @@ -195,9 +181,7 @@ function lint() {
if (argv.files) {
setFilesToLint(argv.files.split(','));
} else if (!eslintRulesChanged() &&
(isTravisPullRequestBuild() ||
process.env.LOCAL_PR_CHECK ||
argv['local-changes'])) {
(process.env.LOCAL_PR_CHECK || argv['local-changes'])) {
const jsFiles = jsFilesChanged();
if (jsFiles.length == 0) {
log(colors.green('INFO: ') + 'No JS files in this PR');
Expand Down
23 changes: 13 additions & 10 deletions validator/.eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -23,33 +23,36 @@
"amphtml-internal/no-module-exports": 0,
"amphtml-internal/no-for-of-statement": 0,
"amphtml-internal/no-has-own-property-method": 0,
"chai-expect/missing-assertion": 1,
"chai-expect/missing-assertion": 0,
"google-camelcase/google-camelcase": 0,
"jasmine/expect-matcher": 0,
"jasmine/no-spec-dupes": 0,
"jasmine/prefer-jasmine-matcher": 0,
"jsdoc/check-param-names": 0,
"jsdoc/check-tag-names": 0,
"jsdoc/check-types": 0,
"jsdoc/require-param": 0,
"jsdoc/require-param-name": 0,
"jsdoc/require-param-type": 0,
"jsdoc/require-returns-type": 0,
"max-len": [1, 80, 4, {
"max-len": [0, 80, 4, {
"ignoreTrailingComments": true,
"ignoreRegExpLiterals": true,
"ignorePattern": "^import.*';|}\\ from.*;|.*require\\(.*;$|@typedef|@param|@return|@private|@const|@type|@implements",
"ignoreUrls": true
}],
"no-cond-assign": 1,
"no-div-regex": 1,
"no-cond-assign": 0,
"no-div-regex": 0,
"no-multi-spaces": 0,
"no-throw-literal": 1,
"no-undef": 1,
"no-unused-vars": [1, {
"no-throw-literal": 0,
"no-undef": 0,
"no-unused-vars": [0, {
"argsIgnorePattern": "^var_|opt_|unused",
"varsIgnorePattern": "AmpElement|Def|Interface$"
}],
"no-useless-concat": 1,
"no-var": 1,
"prefer-const": 1,
"no-useless-concat": 0,
"no-var": 0,
"prefer-const": 0,
"require-jsdoc": 0
}
}