diff --git a/.eslintrc.js b/.eslintrc.js index 1750d7f7..785ce82c 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -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', diff --git a/.github/workflows/continuous-integration-workflow.yml b/.github/workflows/continuous-integration-workflow.yml index eecc9780..4d92533c 100644 --- a/.github/workflows/continuous-integration-workflow.yml +++ b/.github/workflows/continuous-integration-workflow.yml @@ -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: diff --git a/README.md b/README.md index db230c4e..e8be1e1a 100644 --- a/README.md +++ b/README.md @@ -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) diff --git a/package.json b/package.json index ff2a4daf..34dd88e4 100644 --- a/package.json +++ b/package.json @@ -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", @@ -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" diff --git a/packages/@nucleus/ember-cli-build.js b/packages/@nucleus/ember-cli-build.js index 2f724284..040e52f1 100644 --- a/packages/@nucleus/ember-cli-build.js +++ b/packages/@nucleus/ember-cli-build.js @@ -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'); diff --git a/packages/banner/.eslintrc.js b/packages/banner/.eslintrc.js index 1750d7f7..e5132e19 100644 --- a/packages/banner/.eslintrc.js +++ b/packages/banner/.eslintrc.js @@ -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', diff --git a/packages/banner/.template-lintrc.js b/packages/banner/.template-lintrc.js new file mode 100644 index 00000000..cfcac985 --- /dev/null +++ b/packages/banner/.template-lintrc.js @@ -0,0 +1,11 @@ +/* eslint-env node */ +'use strict'; + +module.exports = { + extends: 'recommended', + + rules: { + 'no-bare-strings': false, + 'quotes': 'double' + } +}; diff --git a/packages/banner/addon/templates/components/nucleus-banner.hbs b/packages/banner/addon/templates/components/nucleus-banner.hbs index 27670f82..f179c5cb 100644 --- a/packages/banner/addon/templates/components/nucleus-banner.hbs +++ b/packages/banner/addon/templates/components/nucleus-banner.hbs @@ -1,8 +1,8 @@ {{#if bannerItems.length}} {{#ember-wormhole to="nucleus-banner-wormhole" renderInPlace=false}} -