Skip to content

Commit

Permalink
Merge pull request #49 from josemarluedke/feat/eslint-config
Browse files Browse the repository at this point in the history
New eslint-config & Prettier v2.0.0
  • Loading branch information
josemarluedke committed Mar 26, 2020
2 parents fd0dca9 + 91e08fc commit a4334d6
Show file tree
Hide file tree
Showing 73 changed files with 360 additions and 392 deletions.
4 changes: 2 additions & 2 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ module.exports = {
project: join(__dirname, './tsconfig.eslint.json')
},
plugins: [],
extends: ['@neighborly/eslint-config-ember-typescript'],
extends: ['@underline/eslint-config-ember-typescript'],
rules: {
'@typescript-eslint/no-empty-interface': 'off'
},
Expand Down Expand Up @@ -38,7 +38,7 @@ module.exports = {
'packages/*/addon/tailwind/*.js',
'packages/tailwindcss-plugin-helpers/**/*.js'
],
extends: ['@neighborly/eslint-config-node'],
extends: ['@underline/eslint-config-node'],
rules: {}
}
]
Expand Down
2 changes: 1 addition & 1 deletion .prettierrc.js
Original file line number Diff line number Diff line change
@@ -1 +1 @@
module.exports = require('@neighborly/eslint-config/.prettierrc.js');
module.exports = require('@underline/eslint-config/.prettierrc.js');
4 changes: 2 additions & 2 deletions config/ember-try.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@

const getChannelURL = require('ember-source-channel-url');

module.exports = function() {
module.exports = function () {
return Promise.all([
getChannelURL('release'),
getChannelURL('beta'),
getChannelURL('canary')
]).then(urls => {
]).then((urls) => {
return {
useYarn: true,
scenarios: [
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
"try:one": "yarn workspaces run try:one"
},
"devDependencies": {
"@neighborly/eslint-config-ember-typescript": "^0.6.0",
"@neighborly/eslint-config-node": "^0.6.0",
"@underline/eslint-config-ember-typescript": "^0.7.0",
"@underline/eslint-config-node": "^0.7.0",
"ember-source-channel-url": "^2.0.1",
"ember-template-lint": "^2.4.1",
"eslint": "^6.8.0",
Expand Down
6 changes: 3 additions & 3 deletions packages/buttons/addon/tailwind/index.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
const plugin = require('tailwindcss/plugin');
const { resolve, isEmpty } = require('@frontile/tailwindcss-plugin-helpers');

module.exports = plugin.withOptions(function(userConfig) {
return function({ addComponents, theme }) {
module.exports = plugin.withOptions(function (userConfig) {
return function ({ addComponents, theme }) {
const { options } = resolve(
'@frontile/buttons',
require('./default-options'),
Expand Down Expand Up @@ -46,7 +46,7 @@ module.exports = plugin.withOptions(function(userConfig) {
}
}

Object.keys(options).forEach(key => {
Object.keys(options).forEach((key) => {
const modifier = key === 'default' ? '' : `-${key}`;
addButton(options[key].button, modifier);
});
Expand Down
2 changes: 1 addition & 1 deletion packages/buttons/config/environment.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
'use strict';

module.exports = function(/* environment, appConfig */) {
module.exports = function (/* environment, appConfig */) {
return {};
};
2 changes: 1 addition & 1 deletion packages/buttons/ember-cli-build.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
const EmberAddon = require('ember-cli/lib/broccoli/ember-addon');
const path = require('path');

module.exports = function(defaults) {
module.exports = function (defaults) {
const app = new EmberAddon(defaults, {
postcssOptions: {
compile: {
Expand Down
2 changes: 1 addition & 1 deletion packages/buttons/tests/dummy/app/router.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@ export default class Router extends EmberRouter {
rootURL = config.rootURL;
}

Router.map(function() {
Router.map(function () {
// there are no routes in this dummy app
});
2 changes: 1 addition & 1 deletion packages/buttons/tests/dummy/config/environment.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use strict';

module.exports = function(environment) {
module.exports = function (environment) {
const ENV = {
modulePrefix: 'dummy',
environment,
Expand Down
30 changes: 15 additions & 15 deletions packages/buttons/tests/integration/components/button-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,17 @@ import { setupRenderingTest } from 'ember-qunit';
import { render } from '@ember/test-helpers';
import hbs from 'htmlbars-inline-precompile';

module('Integration | Component | Button', function(hooks) {
module('Integration | Component | Button', function (hooks) {
setupRenderingTest(hooks);

test('it renders', async function(assert) {
test('it renders', async function (assert) {
await render(hbs`<Button data-test-id="button">My Button</Button>`);

assert.dom('[data-test-id="button"]').hasText('My Button');
assert.dom('[data-test-id="button"]').hasAttribute('type', 'button');
});

test('it accepts @type argument', async function(assert) {
test('it accepts @type argument', async function (assert) {
await render(
hbs`<Button @type="submit" data-test-id="button">My Button</Button>`
);
Expand All @@ -23,13 +23,13 @@ module('Integration | Component | Button', function(hooks) {

module('Style classes', () => {
module('@appearance', () => {
test('it adds class for default appearance', async function(assert) {
test('it adds class for default appearance', async function (assert) {
await render(hbs`<Button data-test-id="button">My Button</Button>`);

assert.dom('[data-test-id="button"]').hasClass('btn');
});

test('it adds class for outlined appearance', async function(assert) {
test('it adds class for outlined appearance', async function (assert) {
await render(
hbs`<Button @appearance="outlined" data-test-id="button">My Button</Button>`
);
Expand All @@ -39,7 +39,7 @@ module('Integration | Component | Button', function(hooks) {
assert.dom('[data-test-id="button"]').hasClass('btn-outlined');
});

test('it adds class for outlined appearance', async function(assert) {
test('it adds class for outlined appearance', async function (assert) {
await render(
hbs`<Button @appearance="minimal" data-test-id="button">My Button</Button>`
);
Expand All @@ -51,7 +51,7 @@ module('Integration | Component | Button', function(hooks) {
});

module('@intent', () => {
test('it adds class for the an intent', async function(assert) {
test('it adds class for the an intent', async function (assert) {
await render(
hbs`<Button @intent="primary" data-test-id="button">My Button</Button>`
);
Expand All @@ -65,7 +65,7 @@ module('Integration | Component | Button', function(hooks) {
.doesNotHaveClass('btn-minimal-primary');
});

test('it adds class for the an intent with appearance=outlined', async function(assert) {
test('it adds class for the an intent with appearance=outlined', async function (assert) {
await render(
hbs`<Button
@appearance="outlined"
Expand All @@ -83,7 +83,7 @@ module('Integration | Component | Button', function(hooks) {
.doesNotHaveClass('btn-minimal-primary');
});

test('it adds class for the an intent with appearance=minimal', async function(assert) {
test('it adds class for the an intent with appearance=minimal', async function (assert) {
await render(
hbs`<Button
@appearance="minimal"
Expand All @@ -103,39 +103,39 @@ module('Integration | Component | Button', function(hooks) {
});

module('sizes', () => {
test('it adds class @isXSmall', async function(assert) {
test('it adds class @isXSmall', async function (assert) {
await render(
hbs`<Button @isXSmall={{true}} data-test-id="button">My Button</Button>`
);

assert.dom('[data-test-id="button"]').hasClass('btn-xs');
});

test('it adds class @isSmall', async function(assert) {
test('it adds class @isSmall', async function (assert) {
await render(
hbs`<Button @isSmall={{true}} data-test-id="button">My Button</Button>`
);

assert.dom('[data-test-id="button"]').hasClass('btn-sm');
});

test('it adds class @isLarge', async function(assert) {
test('it adds class @isLarge', async function (assert) {
await render(
hbs`<Button @isLarge={{true}} data-test-id="button">My Button</Button>`
);

assert.dom('[data-test-id="button"]').hasClass('btn-lg');
});

test('it adds class @isXLarge', async function(assert) {
test('it adds class @isXLarge', async function (assert) {
await render(
hbs`<Button @isXLarge={{true}} data-test-id="button">My Button</Button>`
);

assert.dom('[data-test-id="button"]').hasClass('btn-xl');
});

test('it adds class @isLarge with appearance', async function(assert) {
test('it adds class @isLarge with appearance', async function (assert) {
await render(
hbs`<Button @appearance="outlined" @isLarge={{true}} data-test-id="button">My Button</Button>`
);
Expand All @@ -145,7 +145,7 @@ module('Integration | Component | Button', function(hooks) {
});
});

test('it yields classNames when renderless', async function(assert) {
test('it yields classNames when renderless', async function (assert) {
await render(
hbs`<Button @isRenderless={{true}} as |btn|>
<div data-test-id="my-div">{{btn.classNames}}</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ export default class ChangesetFormFieldsBase<
return this.args.errors;
}

const fieldErrors = this.args.changeset.errors.filter(error => {
const fieldErrors = this.args.changeset.errors.filter((error) => {
return error.key === this.args.fieldName;
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export default class ChangesetFormFieldsCheckboxGroup extends Component<
return [];
}

const fieldErrors = this.args.changeset.errors.filter(error => {
const fieldErrors = this.args.changeset.errors.filter((error) => {
return error.key === this.args.groupName;
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export default class ChangesetFormFieldsCheckbox extends Base<
return this.args.errors;
}

const fieldErrors = this.args.changeset.errors.filter(error => {
const fieldErrors = this.args.changeset.errors.filter((error) => {
return error.key === this.fullFieldName;
});

Expand Down
2 changes: 1 addition & 1 deletion packages/changeset-form/config/environment.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
'use strict';

module.exports = function(/* environment, appConfig */) {
module.exports = function (/* environment, appConfig */) {
return {};
};
2 changes: 1 addition & 1 deletion packages/changeset-form/ember-cli-build.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
const EmberAddon = require('ember-cli/lib/broccoli/ember-addon');
const path = require('path');

module.exports = function(defaults) {
module.exports = function (defaults) {
const app = new EmberAddon(defaults, {
postcssOptions: {
compile: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ interface ExampleArgs {}

export default class Example extends Component<ExampleArgs> {
validations = myValidations;
countries = countries.map(c => c.name);
countries = countries.map((c) => c.name);

model = {
firstName: null,
Expand Down
2 changes: 1 addition & 1 deletion packages/changeset-form/tests/dummy/app/router.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@ export default class Router extends EmberRouter {
rootURL = config.rootURL;
}

Router.map(function() {
Router.map(function () {
// there are no routes in this dummy app
});
2 changes: 1 addition & 1 deletion packages/changeset-form/tests/dummy/config/environment.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use strict';

module.exports = function(environment) {
module.exports = function (environment) {
const ENV = {
modulePrefix: 'dummy',
environment,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import hbs from 'htmlbars-inline-precompile';
import validateFormat from 'ember-changeset-validations/validators/format';
import validatePresence from 'ember-changeset-validations/validators/presence';

module('Integration | Component | ChangesetForm', function(hooks) {
module('Integration | Component | ChangesetForm', function (hooks) {
setupRenderingTest(hooks);

hooks.beforeEach(async function beforeEach(this: { set: Function }) {
Expand All @@ -14,7 +14,7 @@ module('Integration | Component | ChangesetForm', function(hooks) {
first: 'Chim',
last: 'Richolds'
},
email: 'chim.richolds@neighborly.com'
email: 'chim.richolds@example.com'
};
const validations = {
'name.first': validatePresence(true),
Expand Down Expand Up @@ -60,7 +60,7 @@ module('Integration | Component | ChangesetForm', function(hooks) {
`);
});

test('it renders with initial value from model', async function(assert) {
test('it renders with initial value from model', async function (assert) {
assert
.dom('[data-test-changeset-form]')
.exists('The ChangesetForm failed to render');
Expand All @@ -76,7 +76,7 @@ module('Integration | Component | ChangesetForm', function(hooks) {
assert.dom('[data-test-email-input]').hasValue(this.get('model.email'));
});

test('it validates and then updates the changeset on input', async function(assert) {
test('it validates and then updates the changeset on input', async function (assert) {
await fillIn('[data-test-email-input]', 'notanemailaddress');
await blur('[data-test-email-input]');

Expand All @@ -87,7 +87,7 @@ module('Integration | Component | ChangesetForm', function(hooks) {
assert.dom('[data-test-email]').hasTextContaining('notanemailaddress');
});

test('it rolls-back the changeset, and calls onReset when reset is clicked', async function(assert) {
test('it rolls-back the changeset, and calls onReset when reset is clicked', async function (assert) {
assert.expect(7);
await fillIn('[data-test-name-first-input]', 'James');
await fillIn('[data-test-name-last-input]', 'Silva');
Expand All @@ -105,12 +105,10 @@ module('Integration | Component | ChangesetForm', function(hooks) {

assert.dom('[data-test-name-first-input]').hasValue('Chim');
assert.dom('[data-test-name-last-input]').hasValue('Richolds');
assert
.dom('[data-test-email-input]')
.hasValue('chim.richolds@neighborly.com');
assert.dom('[data-test-email-input]').hasValue('chim.richolds@example.com');
});

test('it calls onSubmit when the submit button is clicked and marks hasSubmitted to true', async function(assert) {
test('it calls onSubmit when the submit button is clicked and marks hasSubmitted to true', async function (assert) {
assert.expect(8);
await fillIn('[data-test-name-first-input]', 'James');
await fillIn('[data-test-name-last-input]', 'Silva');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { run } from '@ember/runloop';

module(
'Integration | Component | ChangesetForm::Fields::CheckboxGroup',
function(hooks) {
function (hooks) {
setupRenderingTest(hooks);

hooks.beforeEach(async function beforeEach(this: { set: Function }) {
Expand Down Expand Up @@ -46,13 +46,13 @@ module(
`);
});

test('it renders with initial model value', async function(assert) {
test('it renders with initial model value', async function (assert) {
assert.dom('[data-test-checkbox-blue]').isChecked();
assert.dom('[data-test-checkbox-green]').isNotChecked();
assert.dom('[data-test-checkbox-red]').isNotChecked();
});

test('it updates the changeset on input', async function(assert) {
test('it updates the changeset on input', async function (assert) {
await click('[data-test-checkbox-blue]');
await click('[data-test-checkbox-green]');
await click('[data-test-checkbox-red]');
Expand All @@ -62,7 +62,7 @@ module(
assert.equal(this.get('changeset').get('colors.red'), true);
});

test('it receives original input values on rollback', async function(assert) {
test('it receives original input values on rollback', async function (assert) {
await click('[data-test-checkbox-green]');

assert.dom('[data-test-checkbox-blue]').isChecked();
Expand Down

0 comments on commit a4334d6

Please sign in to comment.