Skip to content

Commit

Permalink
chore: Lint workflow checks and cleanup (#102)
Browse files Browse the repository at this point in the history
* Lint fixes

* Template lint fix

* Adding PR lint

* lint status check

* Added lint-staged & precommit hooks

* Removed lint status check

* Added CI badge to Read me

* Workflow changes

* Updated branch name
  • Loading branch information
prakash-chokalingam authored Feb 5, 2020
1 parent 2623f7a commit 83b940e
Show file tree
Hide file tree
Showing 59 changed files with 506 additions and 54 deletions.
1 change: 1 addition & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ module.exports = {
node: true
},
plugins: ['node'],
// eslint-disable-next-line node/no-extraneous-require
rules: Object.assign({}, require('eslint-plugin-node').configs.recommended.rules, {
'comma-dangle': ['error', 'never'],
'ember/new-module-imports': 'off',
Expand Down
31 changes: 26 additions & 5 deletions .github/workflows/continuous-integration-workflow.yml
Original file line number Diff line number Diff line change
@@ -1,17 +1,38 @@
name: CI
name: Build

on:
on:
pull_request:
branches:
- master

push:
branches:
- master

jobs:
build:
name: Build
Lint:
name: Lint
runs-on: macos-latest
steps:
- uses: actions/checkout@v2


- name: Set Node.js 10.13.0
uses: actions/setup-node@master
with:
node-version: 10.13.0

- name: Install dependencies
run: yarn

- name: Run lint check
run: yarn lint

Test:
name: Test
runs-on: macos-latest
steps:
- uses: actions/checkout@v2

- name: Set Node.js 10.13.0
uses: actions/setup-node@master
with:
Expand Down
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
Nucleus - The Freshworks Design System in Ember
==============================================================================

[![Build Status](https://travis-ci.com/freshdesk/nucleus.svg?branch=master)](https://travis-ci.com/freshdesk/nucleus)
![Build](https://github.com/freshdesk/nucleus/workflows/Build/badge.svg?branch=master)
![npm (scoped with tag)](https://img.shields.io/npm/v/@freshworks/button/latest)
![npm (scoped with tag)](https://img.shields.io/npm/v/@freshworks/button/beta)

Expand Down
14 changes: 12 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@
"start": "yarn workspace nucleus start",
"test": "lerna run test --no-private --stream --concurrency 1",
"build": "lerna run build --parallel --no-private",
"lint": "lerna run lint:hbs",
"lint": "lerna run lint:hbs --parallel && lerna run lint:js --parallel",
"lint-staged": "lint-staged",
"lerna:version": "lerna version prerelease --preid beta",
"lerna:publish": "lerna publish --canary --yes --dist-tag beta",
"deploy": "yarn workspace nucleus deploy",
Expand All @@ -21,8 +22,17 @@
"ember-cli": "~3.11.0",
"ember-source-channel-url": "^2.0.0",
"ember-try": "^1.1.0",
"lerna": "^3.20.2"
"lerna": "^3.20.2",
"lint-staged": "^10.0.7",
"pre-commit": "^1.2.2"
},
"lint-staged": {
"*.js": "lerna run lint:js",
"*.hbs": "lerna run lint:hbs"
},
"pre-commit": [
"lint-staged"
],
"engines": {
"node": "^10.13.0",
"yarn": "^1.17.3"
Expand Down
4 changes: 4 additions & 0 deletions packages/@nucleus/ember-cli-build.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
'use strict';

// eslint-disable-next-line node/no-unpublished-require
const EmberAddon = require('ember-cli/lib/broccoli/ember-addon');
// eslint-disable-next-line node/no-unpublished-require
const { UnwatchedDir } = require('broccoli-source');
// eslint-disable-next-line node/no-unpublished-require
const MergeTrees = require('broccoli-merge-trees');
// eslint-disable-next-line node/no-unpublished-require
const Funnel = require('broccoli-funnel');
const { readdirSync } = require('fs');

Expand Down
1 change: 1 addition & 0 deletions packages/banner/.eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ module.exports = {
node: true
},
plugins: ['node'],
// eslint-disable-next-line node/no-unpublished-require
rules: Object.assign({}, require('eslint-plugin-node').configs.recommended.rules, {
'comma-dangle': ['error', 'never'],
'ember/new-module-imports': 'off',
Expand Down
11 changes: 11 additions & 0 deletions packages/banner/.template-lintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
/* eslint-env node */
'use strict';

module.exports = {
extends: 'recommended',

rules: {
'no-bare-strings': false,
'quotes': 'double'
}
};
6 changes: 3 additions & 3 deletions packages/banner/addon/templates/components/nucleus-banner.hbs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{{#if bannerItems.length}}
{{#ember-wormhole to="nucleus-banner-wormhole" renderInPlace=false}}
<div class="nucleus-banner nucleus-banner--{{displayedItem.type}} {{if isFixed 'nucleus-banner--fixed'}}">
<div class="nucleus-banner nucleus-banner--{{displayedItem.type}} {{if isFixed "nucleus-banner--fixed"}}">
<div class="nucleus-banner__main">
{{nucleus-banner/item item=displayedItem onDelete=(action 'deleteItem')}}
{{nucleus-banner/item item=displayedItem onDelete=(action "deleteItem")}}
</div>
{{#if (and _isMultiple stackedItems)}}
<div class="nucleus-banner__more">
Expand All @@ -20,7 +20,7 @@
<ul class="nucleus-banners">
{{#each stackedItems as |hiddenItem|}}
<li class="nucleus-banner--mini nucleus-banner--{{hiddenItem.type}}">
{{nucleus-banner/item item=hiddenItem onDelete=(action 'deleteItem')}}
{{nucleus-banner/item item=hiddenItem onDelete=(action "deleteItem")}}
</li>
{{/each}}
</ul>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<div class="nucleus-banner-item__content">
{{item.title}}
{{#if item.content}}
<a role="button"
<a role="button"
class="nucleus-banner-item__link"
aria-label={{item.content.linkText}}
onClick={{action item.content.linkAction}}>
Expand All @@ -24,5 +24,5 @@
customClass=(concat "nucleus-banner-item__close")
icon="nucleus-cross"
iconSize="mini"
onClick=(action 'onClose' item)}}
{{/if}}
onClick=(action "onClose" item)}}
{{/if}}
3 changes: 1 addition & 2 deletions packages/banner/ember-backstop/backstop.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
const path = require('path');

/* eslint-env node */
module.exports = {
id: `ember-backstop test`,
viewports: [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

const debug = require('debug')('BackstopJS');

module.exports = async (page, scenario, vp) => {
module.exports = async (page, scenario) => {
debug('SCENARIO > ' + scenario.label);
await require('./overrideCSS')(page, scenario);
await require('./clickAndHoverHelper')(page, scenario);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* eslint-env browser, node */

module.exports = function(page, scenario) {
module.exports = function(page) {
// inject arbitrary css to override styles
page.evaluate(() => {
const BACKSTOP_TEST_CSS_OVERRIDE = `#ember-testing {width: 100% !important; height: 100% !important; -webkit-transform: scale(1) !important; transform: scale(1) !important;}`;
Expand Down
1 change: 1 addition & 0 deletions packages/banner/ember-cli-build.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
'use strict';

// eslint-disable-next-line node/no-unpublished-require
const EmberAddon = require('ember-cli/lib/broccoli/ember-addon');

module.exports = function(defaults) {
Expand Down
2 changes: 2 additions & 0 deletions packages/banner/index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
/* eslint-env node */
'use strict';
// eslint-disable-next-line node/no-unpublished-require
const mergeTrees = require('broccoli-merge-trees');
// eslint-disable-next-line node/no-unpublished-require
const Funnel = require('broccoli-funnel');
const path = require('path');

Expand Down
3 changes: 2 additions & 1 deletion packages/banner/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"scripts": {
"build": "ember build",
"lint:hbs": "ember-template-lint .",
"lint:js": "eslint .",
"lint:js": "eslint . --fix",
"start": "ember serve -p 4003",
"deploy": "ember deploy production",
"test": "ember backstop-remote & COVERAGE=TRUE ember test --test-port=1512",
Expand Down Expand Up @@ -66,6 +66,7 @@
"ember-sinon": "^4.0.0",
"ember-sinon-qunit": "^3.4.0",
"ember-source": "~3.13.0",
"ember-template-lint": "^1.13.2",
"ember-test-selectors": "^2.1.0",
"eslint-plugin-ember": "^7.1.0",
"eslint-plugin-node": "^10.0.0",
Expand Down
1 change: 1 addition & 0 deletions packages/button/.eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ module.exports = {
node: true
},
plugins: ['node'],
// eslint-disable-next-line node/no-unpublished-require
rules: Object.assign({}, require('eslint-plugin-node').configs.recommended.rules, {
'comma-dangle': ['error', 'never'],
'ember/new-module-imports': 'off',
Expand Down
11 changes: 11 additions & 0 deletions packages/button/.template-lintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
/* eslint-env node */
'use strict';

module.exports = {
extends: 'recommended',

rules: {
'no-bare-strings': false,
'quotes': 'double'
}
};
3 changes: 1 addition & 2 deletions packages/button/ember-backstop/backstop.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
const path = require('path');

/* eslint-env node */
module.exports = {
id: `ember-backstop test`,
viewports: [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

const debug = require('debug')('BackstopJS');

module.exports = async (page, scenario, vp) => {
module.exports = async (page, scenario) => {
debug('SCENARIO > ' + scenario.label);
await require('./overrideCSS')(page, scenario);
await require('./clickAndHoverHelper')(page, scenario);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* eslint-env browser, node */

module.exports = function(page, scenario) {
module.exports = function(page) {
// inject arbitrary css to override styles
page.evaluate(() => {
const BACKSTOP_TEST_CSS_OVERRIDE = `#ember-testing {width: 100% !important; height: 100% !important; -webkit-transform: scale(1) !important; transform: scale(1) !important;}`;
Expand Down
1 change: 1 addition & 0 deletions packages/button/ember-cli-build.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
'use strict';

// eslint-disable-next-line node/no-unpublished-require
const EmberAddon = require('ember-cli/lib/broccoli/ember-addon');

module.exports = function(defaults) {
Expand Down
2 changes: 2 additions & 0 deletions packages/button/index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
/* eslint-env node */
'use strict';
// eslint-disable-next-line node/no-unpublished-require
const mergeTrees = require('broccoli-merge-trees');
// eslint-disable-next-line node/no-unpublished-require
const Funnel = require('broccoli-funnel');
const path = require('path');

Expand Down
3 changes: 2 additions & 1 deletion packages/button/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"scripts": {
"build": "ember build",
"lint:hbs": "ember-template-lint .",
"lint:js": "eslint .",
"lint:js": "eslint . --fix",
"start": "ember serve -p 4003",
"deploy": "ember deploy production",
"test": "ember backstop-remote & COVERAGE=TRUE ember test --test-port=1509",
Expand Down Expand Up @@ -64,6 +64,7 @@
"ember-sinon": "^4.0.0",
"ember-sinon-qunit": "^3.4.0",
"ember-source": "~3.13.0",
"ember-template-lint": "^1.13.2",
"ember-test-selectors": "^2.1.0",
"eslint-plugin-ember": "^7.1.0",
"eslint-plugin-node": "^10.0.0",
Expand Down
1 change: 1 addition & 0 deletions packages/core/.eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ module.exports = {
node: true
},
plugins: ['node'],
// eslint-disable-next-line node/no-unpublished-require
rules: Object.assign({}, require('eslint-plugin-node').configs.recommended.rules, {
'comma-dangle': ['error', 'never'],
'ember/new-module-imports': 'off',
Expand Down
1 change: 1 addition & 0 deletions packages/core/ember-cli-build.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
'use strict';

// eslint-disable-next-line node/no-unpublished-require
const EmberAddon = require('ember-cli/lib/broccoli/ember-addon');

module.exports = function(defaults) {
Expand Down
1 change: 1 addition & 0 deletions packages/icon/.eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ module.exports = {
node: true
},
plugins: ['node'],
// eslint-disable-next-line node/no-unpublished-require
rules: Object.assign({}, require('eslint-plugin-node').configs.recommended.rules, {
'comma-dangle': ['error', 'never'],
'ember/new-module-imports': 'off',
Expand Down
11 changes: 11 additions & 0 deletions packages/icon/.template-lintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
/* eslint-env node */
'use strict';

module.exports = {
extends: 'recommended',

rules: {
'no-bare-strings': false,
'quotes': 'double'
}
};
3 changes: 1 addition & 2 deletions packages/icon/ember-backstop/backstop.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
const path = require('path');

/* eslint-env node */
module.exports = {
id: `ember-backstop test`,
viewports: [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

const debug = require('debug')('BackstopJS');

module.exports = async (page, scenario, vp) => {
module.exports = async (page, scenario) => {
debug('SCENARIO > ' + scenario.label);
await require('./overrideCSS')(page, scenario);
await require('./clickAndHoverHelper')(page, scenario);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* eslint-env browser, node */

module.exports = function(page, scenario) {
module.exports = function(page) {
// inject arbitrary css to override styles
page.evaluate(() => {
const BACKSTOP_TEST_CSS_OVERRIDE = `#ember-testing {width: 100% !important; height: 100% !important; -webkit-transform: scale(1) !important; transform: scale(1) !important;}`;
Expand Down
1 change: 1 addition & 0 deletions packages/icon/ember-cli-build.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
'use strict';

// eslint-disable-next-line node/no-unpublished-require
const EmberAddon = require('ember-cli/lib/broccoli/ember-addon');

module.exports = function(defaults) {
Expand Down
2 changes: 2 additions & 0 deletions packages/icon/index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
/* eslint-env node */
'use strict';
// eslint-disable-next-line node/no-unpublished-require
const mergeTrees = require('broccoli-merge-trees');
// eslint-disable-next-line node/no-unpublished-require
const Funnel = require('broccoli-funnel');
const path = require('path');

Expand Down
3 changes: 2 additions & 1 deletion packages/icon/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"scripts": {
"build": "ember build",
"lint:hbs": "ember-template-lint .",
"lint:js": "eslint .",
"lint:js": "eslint . --fix",
"start": "ember serve -p 4003",
"deploy": "ember deploy production",
"test": "ember backstop-remote & COVERAGE=TRUE ember test --test-port=1514",
Expand Down Expand Up @@ -63,6 +63,7 @@
"ember-sinon": "^4.0.0",
"ember-sinon-qunit": "^3.4.0",
"ember-source": "~3.13.0",
"ember-template-lint": "^1.13.2",
"ember-test-selectors": "^2.1.0",
"eslint-plugin-ember": "^7.1.0",
"eslint-plugin-node": "^10.0.0",
Expand Down
1 change: 1 addition & 0 deletions packages/inline-banner/.eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ module.exports = {
node: true
},
plugins: ['node'],
// eslint-disable-next-line node/no-unpublished-require
rules: Object.assign({}, require('eslint-plugin-node').configs.recommended.rules, {
'comma-dangle': ['error', 'never'],
'ember/new-module-imports': 'off',
Expand Down
Loading

0 comments on commit 83b940e

Please sign in to comment.