From 71221921df07f1f2e29dd0ed4bb2cae66a324571 Mon Sep 17 00:00:00 2001 From: Chris Thoburn Date: Sat, 30 Mar 2019 15:04:30 -0700 Subject: [PATCH] lint autofix some files --- .travis.yml | 71 +++++++++++++------------- CODE_OF_CONDUCT.md | 2 +- CONTRIBUTING.md | 40 +++++++-------- appveyor.yml | 4 +- bin/changelog | 118 ++++++++++++++++++++++++------------------- bin/lint-features | 7 ++- config/features.json | 3 +- 7 files changed, 131 insertions(+), 114 deletions(-) diff --git a/.travis.yml b/.travis.yml index f0839e27737..2292dc10a11 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,7 +3,7 @@ language: node_js sudo: false dist: trusty node_js: - - "10" + - '10' addons: chrome: stable @@ -37,50 +37,50 @@ jobs: include: # runs tests with current locked deps and linting - stage: test - name: "Linting" + name: 'Linting' if: NOT (branch ~= /^(release|lts).*/) script: - yarn lint:features - yarn lint:js - - name: "Basic Tests" + - name: 'Basic Tests' script: yarn test - stage: additional tests - name: "Optional Features" + name: 'Optional Features' if: NOT (branch ~= /^(release|lts).*/) install: yarn install script: yarn test:optional-features - - name: "Floating Dependencies" + - name: 'Floating Dependencies' install: yarn install --no-lockfile --non-interactive script: yarn test - - name: "Production" + - name: 'Production' install: yarn install script: yarn test:production - - name: "Max Transpilation" + - name: 'Max Transpilation' install: yarn install env: TARGET_IE11=true script: yarn test - - name: "Node Tests" + - name: 'Node Tests' install: yarn install script: yarn test:node # runs tests against each supported Ember version - stage: ember version tests - name: "Ember LTS 2.18" + name: 'Ember LTS 2.18' env: EMBER_TRY_SCENARIO=ember-lts-2.18 - - name: "Ember LTS 3.4" + - name: 'Ember LTS 3.4' env: EMBER_TRY_SCENARIO=ember-lts-3.4 - - name: "Ember Release" + - name: 'Ember Release' if: NOT (branch ~= /^(release|lts).*/) env: EMBER_TRY_SCENARIO=ember-release - - name: "Ember Beta" + - name: 'Ember Beta' if: NOT (branch ~= /^(release|lts).*/) env: EMBER_TRY_SCENARIO=ember-beta - - name: "Ember Canary" + - name: 'Ember Canary' if: NOT (branch ~= /^(release|lts).*/) env: EMBER_TRY_SCENARIO=ember-canary @@ -88,37 +88,36 @@ jobs: # We typically have 4 concurrent jobs, these jobs below are ordered to optimize total completion time # By running longer jobs first, we allow the shorter jobs to complete within the same time block in parallel - stage: external partner tests - name: "Ilios Frontend" # ~30min job + name: 'Ilios Frontend' # ~30min job script: yarn test-external:ilios-frontend - - name: "Travis Web" # ~10min job + - name: 'Travis Web' # ~10min job script: yarn test-external:travis-web - - name: "Ember Data Storefront" # ~5min job + - name: 'Ember Data Storefront' # ~5min job script: yarn test-external:storefront - - name: "Ember Data Factory Guy" # ~5min job + - name: 'Ember Data Factory Guy' # ~5min job script: yarn test-external:factory-guy - - name: "Ember Observer" # ~5min job + - name: 'Ember Observer' # ~5min job script: yarn test-external:ember-observer - - name: "Ember Resource Metadata" # ~4.25min job + - name: 'Ember Resource Metadata' # ~4.25min job script: yarn test-external:ember-resource-metadata - - name: "Ember Data Relationship Tracker" # ~4.25min job + - name: 'Ember Data Relationship Tracker' # ~4.25min job script: yarn test-external:ember-data-relationship-tracker - - name: "Ember Data Model Fragments" # ~3.5min job + - name: 'Ember Data Model Fragments' # ~3.5min job script: yarn test-external:model-fragments - - name: "emberaddons.com" # ~3.5min job + - name: 'emberaddons.com' # ~3.5min job script: yarn test-external:emberaddons.com - - name: "Ember Data Change Tracker" # ~3.5min job + - name: 'Ember Data Change Tracker' # ~3.5min job script: yarn test-external:ember-data-change-tracker - - name: "ember-m3" # ~3.5min job + - name: 'ember-m3' # ~3.5min job script: yarn test-external:ember-m3 - stage: deploy - name: "Publish" + name: 'Publish' install: yarn install script: - node_modules/.bin/ember try:reset - yarn build:production - before_install: - curl -o- -L https://yarnpkg.com/install.sh | bash - export PATH=$HOME/.yarn/bin:$PATH @@ -131,18 +130,18 @@ script: env: global: - - BROCCOLI_ENV="production" - - S3_BUILD_CACHE_BUCKET=emberjs-build-cache - - S3_BUCKET_NAME=builds.emberjs.com - - secure: ! 'S+DIdzEPvqQenk1cFq5UjbkoEKDY4j3E/g+Wlz798xxyTkrKQZxoazLXng8I + - BROCCOLI_ENV="production" + - S3_BUILD_CACHE_BUCKET=emberjs-build-cache + - S3_BUCKET_NAME=builds.emberjs.com + - secure: ! 'S+DIdzEPvqQenk1cFq5UjbkoEKDY4j3E/g+Wlz798xxyTkrKQZxoazLXng8I - gsxElZtB2kpyUq81gWgZcuygO53mcBuCa4rPIsh0Di6Ik+HDELSFVZ4EN4NK + gsxElZtB2kpyUq81gWgZcuygO53mcBuCa4rPIsh0Di6Ik+HDELSFVZ4EN4NK - z9yP6D7pMY+RnlSvErf3OXSzrxkDcXDxCU4ljBJl1rNBbtAOu5E=' - - secure: ! 'YjnT2cF8K0M2fSkab+PY3j8XzumBrjzeGsAN4jtyw4shqnywFaE68qO1IIjY + z9yP6D7pMY+RnlSvErf3OXSzrxkDcXDxCU4ljBJl1rNBbtAOu5E=' + - secure: ! 'YjnT2cF8K0M2fSkab+PY3j8XzumBrjzeGsAN4jtyw4shqnywFaE68qO1IIjY - UvaE/CbWMxO/6FszR02gJHaF+YyfU5WAS0ahFFLHuC1twMtQPxi+nScjKZEs + UvaE/CbWMxO/6FszR02gJHaF+YyfU5WAS0ahFFLHuC1twMtQPxi+nScjKZEs - kLwKiKgRNhindV3WvbUcoiIrmrgBMCiBRRd4eyVBlhbZ8RTo1Ig=' + kLwKiKgRNhindV3WvbUcoiIrmrgBMCiBRRd4eyVBlhbZ8RTo1Ig=' - - secure: "hJZXijsot2wMiMsxbDImH+nB5v77a7O7lQ7bicOQEQxmnTtXSvqfa4X4vQ/d4o7NNYYYHUuOpyILgRV+arqI6UOi7XEVGka/7M5q58R5exS6bk0cY0jnpUhUVW/8mpKEUgcVeE6mIDWaR090l3uaT2JhU/WSLkzbj45e38HaF/4=" + - secure: 'hJZXijsot2wMiMsxbDImH+nB5v77a7O7lQ7bicOQEQxmnTtXSvqfa4X4vQ/d4o7NNYYYHUuOpyILgRV+arqI6UOi7XEVGka/7M5q58R5exS6bk0cY0jnpUhUVW/8mpKEUgcVeE6mIDWaR090l3uaT2JhU/WSLkzbj45e38HaF/4=' diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md index e40f0abf1d9..1c08dc578ac 100644 --- a/CODE_OF_CONDUCT.md +++ b/CODE_OF_CONDUCT.md @@ -1,7 +1,7 @@ # Code Of Conduct The `ember-data` core team and and the broader `Ember` community are committed to everyone - having a safe and inclusive experience. +having a safe and inclusive experience. - Our **Community Guidelines / Code of Conduct** can be found at [emberjs.com/guidelines](https://emberjs.com/guidelines/) - A history of updates to this page is located at [https://github.com/emberjs/website/commits/master/source/guidelines.html.erb](https://github.com/emberjs/website/commits/master/source/guidelines.html.erb) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index bda7b31ab74..00adb332fa6 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -49,13 +49,13 @@ are narrowly scoped with clear understanding of alternatives, drawbacks, and the 4. Attend the weekly team meeting to discuss your idea 5. Open an [RFC issue](https://github.com/emberjs/rfcs/issues?q=is%3Aissue+is%3Aopen+label%3AT-ember-data) to broaden and record the discussion if the idea needs more time for discussion and iteration. - * label your issue with `T-ember-data` (or ask someone in `#dev-ember-data` to add the label if you lack the permission) - * announce your issue in `#dev-ember-data` and anywhere else desired such as `#news-and-announcements` and `twitter`. + - label your issue with `T-ember-data` (or ask someone in `#dev-ember-data` to add the label if you lack the permission) + - announce your issue in `#dev-ember-data` and anywhere else desired such as `#news-and-announcements` and `twitter`. 6. [Draft an RFC](https://github.com/emberjs/rfcs#what-the-process-is) and share it with those you have been discussing the ideas with. 7. Publish your RFC by opening a PR to [emberjs/rfcs/](https://github.com/emberjs/rfcs/pulls?q=is%3Apr+is%3Aopen+label%3AT-ember-data) - * label your PR with `T-ember-data` (or ask someone in `#dev-ember-data` to add the label if you lack the permission) - * announce your PR in `#dev-ember-data` and anywhere else desired such as `#news-and-announcements` and `twitter`. + - label your PR with `T-ember-data` (or ask someone in `#dev-ember-data` to add the label if you lack the permission) + - announce your PR in `#dev-ember-data` and anywhere else desired such as `#news-and-announcements` and `twitter`. 8. Attend weekly team meetings to discuss the RFC, continue iterating on the RFC, and help shepherd it to completion. 9. Build a proof-of-concept. Sometimes this is best if it occurs alongside drafting the RFC, as it often informs the RFC design, known drawbacks, and alternatives. Often it will become incorporated in the final implementation. @@ -69,23 +69,23 @@ Before implementing a feature or a fix, it is usually best to discuss the propos existing public APIs. If this is the case, it is even more important to discuss the issue's problem space and the proposed changes before diving too deep into the implementation. -* Submissions should be made as PRs against the `master` branch. +- Submissions should be made as PRs against the `master` branch. #### Writing Tests All PRs should have accompanying tests. For bug-fixes, this should include tests that demonstrate - the issue being fixed and test that the solution works. +the issue being fixed and test that the solution works. -* We do write tests for our warns and assertion messages, using the `assert.expectAssertion()` and `assert.expectWarning()` helpers. -* Because Travis runs tests in the `production` environment, assertions and warnings are stripped out. To avoid tests on +- We do write tests for our warns and assertion messages, using the `assert.expectAssertion()` and `assert.expectWarning()` helpers. +- Because Travis runs tests in the `production` environment, assertions and warnings are stripped out. To avoid tests on warning/assertion messages failing for your PR, use the `testInDebug` function instead of `qunit` `test` to skip them in production. -* Include tests that fail without your code, and pass with it -* Update the documentation, examples, and guides when affected by your contribution +- Include tests that fail without your code, and pass with it +- Update the documentation, examples, and guides when affected by your contribution #### Running Tests -* PRs will automatically run an extensive set of test scenarios for your work -* `ember-data` is an `ember-addon` and uses `ember-cli`. To run tests locally +- PRs will automatically run an extensive set of test scenarios for your work +- `ember-data` is an `ember-addon` and uses `ember-cli`. To run tests locally use `ember test` or `ember test --serve`. For additional test commands see the list of commands in [./package.json](./package.json) @@ -93,14 +93,14 @@ All PRs should have accompanying tests. For bug-fixes, this should include tests All commits should be tagged. Tags are denoted by square brackets (`[]`) and come at the start of the commit message. -* `[CLEANUP]`: commits that remove deprecated functionality -* `[CHORE]`: commits that refactor code or update dependencies -* `[TEST ]`: commits that add tests for a feature -* `[FEAT ]`: commits that add features -* `[DOC ]` | `[DOC]`: commits that add or fix documentation for a feature -* `[SECURITY ]`: commits that address security vulnerabilities. Please do not submit security related PRs without +- `[CLEANUP]`: commits that remove deprecated functionality +- `[CHORE]`: commits that refactor code or update dependencies +- `[TEST ]`: commits that add tests for a feature +- `[FEAT ]`: commits that add features +- `[DOC ]` | `[DOC]`: commits that add or fix documentation for a feature +- `[SECURITY ]`: commits that address security vulnerabilities. Please do not submit security related PRs without coordinating with the security team. See the [Security Policy](https://emberjs.com/security/) for more information. -* `[BUGFIX ]`: commits that fix an issue. The PR should also specify the github issue # of the +- `[BUGFIX ]`: commits that fix an issue. The PR should also specify the github issue # of the issue being resolved. In general almost all commits should fall into one of the above categories. In the cases where they don't please submit @@ -189,4 +189,4 @@ for analysis. To run scenarios: ## Notes -* Commit tagging section taken from [ember.js](https://github.com/emberjs/ember.js/blob/5641c3089180bdd1d4fa54e9dd2d3ac285f088e4/CONTRIBUTING.md#commit-tagging) +- Commit tagging section taken from [ember.js](https://github.com/emberjs/ember.js/blob/5641c3089180bdd1d4fa54e9dd2d3ac285f088e4/CONTRIBUTING.md#commit-tagging) diff --git a/appveyor.yml b/appveyor.yml index d5960343249..e9c2b5b7759 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -3,7 +3,7 @@ # Test against these versions of Node.js. environment: matrix: - - nodejs_version: "6" + - nodejs_version: '6' cache: - '%LOCALAPPDATA%\Yarn' @@ -27,4 +27,4 @@ test_script: build: off # Set build version format here instead of in the admin panel. -version: "{build}" +version: '{build}' diff --git a/bin/changelog b/bin/changelog index cff84b3dcbc..86a918dc443 100755 --- a/bin/changelog +++ b/bin/changelog @@ -11,13 +11,13 @@ * bin/changelog */ -var EOL = require('os').EOL; -var RSVP = require('rsvp'); -var Promise = RSVP.Promise; +var EOL = require('os').EOL; +var RSVP = require('rsvp'); +var Promise = RSVP.Promise; var GitHubApi = require('github'); -var execSync = require('child_process').execSync; +var execSync = require('child_process').execSync; -var github = new GitHubApi({version: '3.0.0'}); +var github = new GitHubApi({ version: '3.0.0' }); var compareCommits = RSVP.denodeify(github.repos.compareCommits); var currentVersion = process.env.PRIOR_VERSION; var head = process.env.HEAD || 'master'; @@ -26,74 +26,90 @@ compareCommits({ user: 'emberjs', repo: 'data', base: currentVersion, - head: head -}) -.then(processPages) -.then(console.log) -.catch(function(err) { - console.error(err); + head: head, }) + .then(processPages) + .then(console.log) + .catch(function(err) { + console.error(err); + }); function getCommitMessage(commitInfo) { var message = commitInfo.commit.message; if (message.indexOf('cherry picked from commit') > -1) { var cherryPickRegex = /cherry picked from commit ([a-z0-9]+)/; - var originalCommit = cherryPickRegex.exec(message)[1] + var originalCommit = cherryPickRegex.exec(message)[1]; try { // command from http://stackoverflow.com/questions/8475448/find-merge-commit-which-include-a-specific-commit - message = execSync('commit=$((git rev-list ' + originalCommit + '..origin/master --ancestry-path | cat -n; git rev-list ' + originalCommit + '..origin/master --first-parent | cat -n) | sort -k2 | uniq -f1 -d | sort -n | tail -1 | cut -f2) && git show --format="%s\n\n%b" $commit', { encoding: 'utf8' }); - } catch(e) { } + message = execSync( + 'commit=$((git rev-list ' + + originalCommit + + '..origin/master --ancestry-path | cat -n; git rev-list ' + + originalCommit + + '..origin/master --first-parent | cat -n) | sort -k2 | uniq -f1 -d | sort -n | tail -1 | cut -f2) && git show --format="%s\n\n%b" $commit', + { encoding: 'utf8' } + ); + } catch (e) {} } return message; } function processPages(res) { - var contributions = res.commits.filter(function(commitInfo) { - var message = commitInfo.commit.message; - return message.indexOf('Merge pull request #') > -1 || message.indexOf('cherry picked from') > -1 || message.match(/\(#\d+\)\n/) - }).map(function(commitInfo) { - var message = getCommitMessage(commitInfo); - var match = message.match(/#(\d+) from (.*)\//); - var squashMatch = message.match(/#(\d+)\)\n/) - var result = { - sha: commitInfo.sha - }; + var contributions = res.commits + .filter(function(commitInfo) { + var message = commitInfo.commit.message; + return ( + message.indexOf('Merge pull request #') > -1 || + message.indexOf('cherry picked from') > -1 || + message.match(/\(#\d+\)\n/) + ); + }) + .map(function(commitInfo) { + var message = getCommitMessage(commitInfo); + var match = message.match(/#(\d+) from (.*)\//); + var squashMatch = message.match(/#(\d+)\)\n/); + var result = { + sha: commitInfo.sha, + }; - if (match) { - var numAndAuthor = match.slice(1, 3); + if (match) { + var numAndAuthor = match.slice(1, 3); - result.number = numAndAuthor[0]; - result.title = message.split('\n\n')[1]; - } else if (squashMatch) { - result.number = squashMatch[1]; - result.title = message.split('\n\n')[0]; - } else { - result.title = message.split('\n\n')[0]; - } + result.number = numAndAuthor[0]; + result.title = message.split('\n\n')[1]; + } else if (squashMatch) { + result.number = squashMatch[1]; + result.title = message.split('\n\n')[0]; + } else { + result.title = message.split('\n\n')[0]; + } - return result; - }).sort(function(a, b) { - return a.number > b.number; - }).map(function(pr) { - var title = pr.title; - var link; - if (pr.number) { - link = '[#' + pr.number + ']' + '(https://github.com/emberjs/data/pull/' + pr.number + ')'; - } else { - link = '[' + pr.sha.slice(0, 8) + '](https://github.com/emberjs/data/commit/' + pr.sha + ')'; - } + return result; + }) + .sort(function(a, b) { + return a.number > b.number; + }) + .map(function(pr) { + var title = pr.title; + var link; + if (pr.number) { + link = '[#' + pr.number + ']' + '(https://github.com/emberjs/data/pull/' + pr.number + ')'; + } else { + link = + '[' + pr.sha.slice(0, 8) + '](https://github.com/emberjs/data/commit/' + pr.sha + ')'; + } - return '- ' + link + ' ' + title; - }).join('\n'); + return '- ' + link + ' ' + title; + }) + .join('\n'); if (github.hasNextPage(res)) { - return github.getNextPage(res) - .then(function(nextPage) { - contributions += processPages(nextPage); - }); + return github.getNextPage(res).then(function(nextPage) { + contributions += processPages(nextPage); + }); } else { return RSVP.resolve(contributions); } diff --git a/bin/lint-features b/bin/lint-features index 3eb65b78f14..2b308f84000 100755 --- a/bin/lint-features +++ b/bin/lint-features @@ -4,12 +4,15 @@ var features = require('../config/features'); var beginsWithDS = /^ds-/; -var violations = Object.keys(features).filter(function(feature){ +var violations = Object.keys(features).filter(function(feature) { return !beginsWithDS.exec(feature); }); if (violations.length) { - console.log('Features in features.json MUST begin with `ds-`! These features do not:', violations.join(' ')); + console.log( + 'Features in features.json MUST begin with `ds-`! These features do not:', + violations.join(' ') + ); process.exit(1); } else { console.log('Features passed linting!'); diff --git a/config/features.json b/config/features.json index 2c63c085104..0967ef424bc 100644 --- a/config/features.json +++ b/config/features.json @@ -1,2 +1 @@ -{ -} +{}