npm run format

This commit is contained in:
Abdón Rodríguez Davila
2020-04-07 11:43:16 +02:00
committed by Justin Fagnani
parent fae1b82b91
commit 4b231be37d
6 changed files with 39 additions and 31 deletions

View File

@@ -1,15 +1,15 @@
const syntaxHighlight = require("@11ty/eleventy-plugin-syntaxhighlight"); const syntaxHighlight = require('@11ty/eleventy-plugin-syntaxhighlight');
module.exports = function(eleventyConfig) { module.exports = function (eleventyConfig) {
eleventyConfig.addPlugin(syntaxHighlight); eleventyConfig.addPlugin(syntaxHighlight);
return { return {
dir: { dir: {
input: "docs-src", input: 'docs-src',
output: "docs" output: 'docs',
}, },
templateExtensionAliases: { templateExtensionAliases: {
"11ty.cjs": "11ty.js", '11ty.cjs': '11ty.js',
"11tydata.cjs": "11tydata.js" '11tydata.cjs': '11tydata.js',
} },
}; };
}; };

View File

@@ -9,17 +9,18 @@
"ecmaVersion": 2020, "ecmaVersion": 2020,
"sourceType": "module" "sourceType": "module"
}, },
"plugins": [ "plugins": ["@typescript-eslint"],
"@typescript-eslint"
],
"rules": { "rules": {
"no-unexpected-multiline": "off", "no-unexpected-multiline": "off",
"@typescript-eslint/indent": "off", "@typescript-eslint/indent": "off",
"@typescript-eslint/explicit-function-return-type": "off", "@typescript-eslint/explicit-function-return-type": "off",
"@typescript-eslint/no-non-null-assertion": "off", "@typescript-eslint/no-non-null-assertion": "off",
"@typescript-eslint/no-use-before-define": "off", "@typescript-eslint/no-use-before-define": "off",
"@typescript-eslint/no-unused-vars": ["warn", { "@typescript-eslint/no-unused-vars": [
"warn",
{
"argsIgnorePattern": "^_" "argsIgnorePattern": "^_"
}] }
]
} }
} }

View File

@@ -1,24 +1,24 @@
const { createDefaultConfig } = require('@open-wc/testing-karma'); const {createDefaultConfig} = require('@open-wc/testing-karma');
const merge = require('deepmerge'); const merge = require('deepmerge');
module.exports = config => { module.exports = (config) => {
config.set( config.set(
merge(createDefaultConfig(config), { merge(createDefaultConfig(config), {
frameworks: ['mocha', 'chai'], frameworks: ['mocha', 'chai'],
client: { client: {
mocha: {ui: 'tdd'} mocha: {ui: 'tdd'},
}, },
files: [ files: [
{ {
pattern: config.grep ? config.grep : 'test/**/*_test.js', pattern: config.grep ? config.grep : 'test/**/*_test.js',
type: 'module' type: 'module',
}, },
], ],
// See the karma-esm docs for all options // See the karma-esm docs for all options
esm: { esm: {
nodeResolve: true, nodeResolve: true,
}, },
}), })
); );
return config; return config;
}; };

View File

@@ -42,6 +42,6 @@ export default {
}), }),
filesize({ filesize({
showBrotliSize: true, showBrotliSize: true,
}) }),
] ],
} };

View File

@@ -4,7 +4,6 @@ import {fixture, html} from '@open-wc/testing';
const assert = chai.assert; const assert = chai.assert;
suite('my-element', () => { suite('my-element', () => {
test('is defined', () => { test('is defined', () => {
const el = document.createElement('my-element'); const el = document.createElement('my-element');
assert.instanceOf(el, MyElement); assert.instanceOf(el, MyElement);
@@ -12,32 +11,40 @@ suite('my-element', () => {
test('renders with default values', async () => { test('renders with default values', async () => {
const el = await fixture(html`<my-element></my-element>`); const el = await fixture(html`<my-element></my-element>`);
assert.shadowDom.equal(el, ` assert.shadowDom.equal(
el,
`
<h1>Hello, World!</h1> <h1>Hello, World!</h1>
<button part="button">Click Count: 0</button> <button part="button">Click Count: 0</button>
<slot></slot> <slot></slot>
`); `
);
}); });
test('renders with a set name', async () => { test('renders with a set name', async () => {
const el = await fixture(html`<my-element name="Test"></my-element>`); const el = await fixture(html`<my-element name="Test"></my-element>`);
assert.shadowDom.equal(el, ` assert.shadowDom.equal(
el,
`
<h1>Hello, Test!</h1> <h1>Hello, Test!</h1>
<button part="button">Click Count: 0</button> <button part="button">Click Count: 0</button>
<slot></slot> <slot></slot>
`); `
);
}); });
test('handles a click', async () => { test('handles a click', async () => {
const el = await fixture(html`<my-element></my-element>`) as MyElement; const el = (await fixture(html`<my-element></my-element>`)) as MyElement;
const button = el.shadowRoot!.querySelector('button')!; const button = el.shadowRoot!.querySelector('button')!;
button.click(); button.click();
await el.updateComplete; await el.updateComplete;
assert.shadowDom.equal(el, ` assert.shadowDom.equal(
el,
`
<h1>Hello, World!</h1> <h1>Hello, World!</h1>
<button part="button">Click Count: 1</button> <button part="button">Click Count: 1</button>
<slot></slot> <slot></slot>
`); `
);
}); });
}); });

View File

@@ -20,7 +20,7 @@
"plugins": [ "plugins": [
{ {
"name": "ts-lit-plugin", "name": "ts-lit-plugin",
"strict": true, "strict": true
} }
] ]
}, },