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

chore: Style lint implementation #105

Merged
merged 11 commits into from
Feb 7, 2020
10 changes: 8 additions & 2 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// eslint-disable-next-line node/no-extraneous-require
const ESLINT_PLUGIN_NODE = require('eslint-plugin-node');

module.exports = {
root: true,
parser: 'babel-eslint',
Expand Down Expand Up @@ -38,15 +41,18 @@ module.exports = {
'tests/dummy/app/**'
],
parserOptions: {
sourceType: 'script'
sourceType: 'script',
"ecmaFeatures": {
"legacyDecorators": true
}
},
env: {
browser: false,
node: true
},
plugins: ['node'],
// eslint-disable-next-line node/no-extraneous-require
rules: Object.assign({}, require('eslint-plugin-node').configs.recommended.rules, {
rules: Object.assign({}, ESLINT_PLUGIN_NODE.configs.recommended.rules, {
'comma-dangle': ['error', 'never'],
'ember/new-module-imports': 'off',
'ember/order-in-components': 2,
Expand Down
10 changes: 7 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,10 @@
"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 --parallel && lerna run lint:js --parallel",
"lint:js": "eslint . --fix --ignore-path .gitignore",
"lint:style": "stylelint **/*.scss",
"lint:hbs": "ember-template-lint .",
"lint": "yarn lint:js & yarn lint:style & yarn lint:hbs",
"lint-staged": "lint-staged",
"lerna:version": "lerna version prerelease --preid beta",
"lerna:publish": "lerna publish --canary --yes --dist-tag beta",
Expand All @@ -27,8 +30,9 @@
"pre-commit": "^1.2.2"
},
"lint-staged": {
"*.js": "lerna run lint:js",
"*.hbs": "lerna run lint:hbs"
"*.js": "eslint . --fix --ignore-path .gitignore",
"*.hbs": "ember-template-lint .",
"*.scss": "stylelint **/*.scss"
},
"pre-commit": [
"lint-staged"
Expand Down
1 change: 1 addition & 0 deletions packages/@nucleus/config/environment.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* eslint-env node */
module.exports = function(/* environment, appConfig */) {
return { };
};
9 changes: 1 addition & 8 deletions packages/@nucleus/ember-cli-build.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,14 +44,7 @@ module.exports = function(defaults) {
);

let app = new EmberAddon(defaults, {
stylelint: {
linterConfig:{
syntax: 'scss'
},
includePaths: [
'app/styles'
]
},
hinting: false,
'ember-cli-addon-docs': {
projects: {
main: tree
Expand Down
3 changes: 2 additions & 1 deletion packages/@nucleus/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@
"start": "ember serve -p 1508",
"deploy": "ember deploy production",
"test": "COVERAGE=TRUE ember test",
"test:dev": "COVERAGE=TRUE ember test --server -launch=false"
"test:dev": "COVERAGE=TRUE ember test --server -launch=false",
"lint:style": "stylelint **/*.scss"
prakash-chokalingam marked this conversation as resolved.
Show resolved Hide resolved
},
"dependencies": {
"@freshworks/banner": "^0.3.0",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{{!-- BEGIN-SNIPPET nucleus-banner-2-helper.hbs --}}
<div class="banner-custom">
This is a <a class="docs-link" onclick={{action 'onCustomClick'}}>custom</a> component with custom <b>markup</b>.
This is a <a class="docs-link" href="#" onclick={{action "onCustomClick"}}>custom</a> component with custom <b>markup</b>.
</div>
{{!-- END-SNIPPET --}}
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,5 @@
Warning
</button>
{{/demo.example}}
{{demo.snippet 'nucleus-banner.js'}}
{{demo.snippet "nucleus-banner.js"}}
{{/docs-demo}}
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
Custom component
</button>
{{/demo.example}}
{{demo.snippet 'nucleus-banner-2.js' label="component.js"}}
{{demo.snippet 'nucleus-banner-2-helper.hbs' label="dummy-comp/demo-2-helper.hbs"}}
{{demo.snippet 'nucleus-banner-2-helper.js' label="dummy-comp/demo-2-helper.js"}}
{{demo.snippet "nucleus-banner-2.js" label="component.js"}}
{{demo.snippet "nucleus-banner-2-helper.hbs" label="dummy-comp/demo-2-helper.hbs"}}
{{demo.snippet "nucleus-banner-2-helper.js" label="dummy-comp/demo-2-helper.js"}}
{{/docs-demo}}
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,21 @@
<table>
<thead>
<tr>
{{!-- template-lint-disable no-inline-styles --}}
<th style="width: 50%">Icon</th>
<th>Name</th>
</tr>
</thead>
<tbody>
{{#each icons as |icon|}}
<tr>
{{!-- template-lint-disable no-inline-styles --}}
<td style="text-align: center">{{nucleus-icon name=icon}}</td>
<td>{{icon}}</td>
</tr>
{{/each}}
</tbody>
</table>

{{/demo.example}}
{{/docs-demo}}
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{{#docs-demo as |demo|}}
{{#demo.example name="nucleus-inline-banner-2.hbs"}}
{{#nucleus-inline-banner type="success" as |banner|}}
<div>Some custom content. <a class="docs-link" onclick={{action banner.close}}>Click here to close.</a></div>
<div>Some custom content. <a class="docs-link" href="#" onclick={{action banner.close}}>Click here to close.</a></div>
{{/nucleus-inline-banner}}
{{/demo.example}}
{{demo.snippet "nucleus-inline-banner-2.hbs"}}
Expand Down
1 change: 1 addition & 0 deletions packages/@nucleus/tests/dummy/config/environment.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
'use strict';

/* eslint-env node */
module.exports = function(environment) {
let ENV = {
modulePrefix: 'dummy',
Expand Down
1 change: 1 addition & 0 deletions packages/@nucleus/tests/dummy/config/targets.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
'use strict';

/* eslint-env node */
const browsers = [
'last 1 Chrome versions',
'last 1 Firefox versions',
Expand Down
20 changes: 0 additions & 20 deletions packages/banner/.eslintignore

This file was deleted.

64 changes: 0 additions & 64 deletions packages/banner/.eslintrc.js

This file was deleted.

11 changes: 0 additions & 11 deletions packages/banner/.template-lintrc.js

This file was deleted.

1 change: 1 addition & 0 deletions packages/banner/config/environment.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
'use strict';

/* eslint-env node */
module.exports = function(environment) {
let ENV = {
modulePrefix: 'nucleus',
Expand Down
10 changes: 1 addition & 9 deletions packages/banner/ember-cli-build.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,7 @@ const EmberAddon = require('ember-cli/lib/broccoli/ember-addon');
module.exports = function(defaults) {
let app = new EmberAddon(defaults,
{
hinting: false,
stylelint: {
linterConfig:{
syntax: 'scss'
},
includePaths: [
'app/styles'
]
}
hinting: false
}
);

Expand Down
5 changes: 3 additions & 2 deletions packages/banner/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,9 @@
},
"scripts": {
"build": "ember build",
"lint:hbs": "ember-template-lint .",
"lint:js": "eslint . --fix",
"lint:hbs": "ember-template-lint . --config-path ../../.template-lintrc.js",
"lint:js": "eslint . --fix --ignore-path ../../.gitignore",
"lint:style": "stylelint **/*.scss",
"start": "ember serve -p 4003",
"deploy": "ember deploy production",
"test": "ember backstop-remote & COVERAGE=TRUE ember test --test-port=1512",
Expand Down
1 change: 1 addition & 0 deletions packages/banner/tests/dummy/config/environment.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
'use strict';

/* eslint-env node */
module.exports = function(environment) {
let ENV = {
modulePrefix: 'dummy',
Expand Down
1 change: 1 addition & 0 deletions packages/banner/tests/dummy/config/targets.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
'use strict';

/* eslint-env node */
const browsers = [
'last 1 Chrome versions',
'last 1 Firefox versions',
Expand Down
20 changes: 0 additions & 20 deletions packages/button/.eslintignore

This file was deleted.

67 changes: 0 additions & 67 deletions packages/button/.eslintrc.js

This file was deleted.

Loading