Skip to content

Commit

Permalink
feat(eslint): multiple lint config updates
Browse files Browse the repository at this point in the history
  • Loading branch information
jeffchew committed Nov 2, 2023
1 parent d12b300 commit 8523165
Show file tree
Hide file tree
Showing 10 changed files with 123 additions and 66 deletions.
39 changes: 39 additions & 0 deletions .commitlintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
{
"extends": [
"@commitlint/config-conventional"
],
"rules": {
"header-max-length": [
2,
"always",
72
],
"body-max-line-length": [
2,
"always",
80
],
"scope-case": [
0,
"always",
"lower-case"
],
"type-enum": [
2,
"always",
[
"build",
"ci",
"chore",
"docs",
"feat",
"fix",
"perf",
"refactor",
"revert",
"test",
"style"
]
]
}
}
35 changes: 35 additions & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
{
"extends": [
"./node_modules/eslint-config-carbon"
],
"overrides": [
{
"files": [
"**/*.js",
"**/*.ts"
],
"rules": {
"jsdoc/require-jsdoc": [
2,
{
"require": {
"ArrowFunctionExpression": true,
"ClassDeclaration": true,
"FunctionDeclaration": true,
"MethodDefinition": true
}
}
],
"jsdoc/require-param-description": 2,
"jsdoc/require-param-name": 2,
"jsdoc/require-param": 2,
"jsdoc/require-param-type": 2,
"jsdoc/valid-types": 2,
"jsdoc/check-param-names": 0,
"jsdoc/check-tag-names": 0,
"jsdoc/check-types": 0,
"jsdoc/check-values": 0
}
}
]
}
15 changes: 15 additions & 0 deletions .lintstagedrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"**/*.js": [
"prettier --cache --write",
"eslint",
"pnpm lint:license:staged"
],
"**/*.scss": [
"prettier --cache --write",
"stylelint --report-needless-disables --report-invalid-scope-disables --allow-empty-input",
"pnpm lint:license:staged"
],
"*.md": [
"prettier --cache --write"
]
}
5 changes: 5 additions & 0 deletions .stylelintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"extends": [
"stylelint-config-carbon"
]
}
64 changes: 0 additions & 64 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -69,69 +69,5 @@
"stylelint": "^15.11.0",
"stylelint-config-carbon": "^1.16.0",
"vite": "^4.4.5"
},
"commitlint": {
"extends": [
"@commitlint/config-conventional"
],
"rules": {
"header-max-length": [
2,
"always",
72
],
"body-max-line-length": [
2,
"always",
80
],
"scope-case": [
0,
"always",
"lower-case"
],
"type-enum": [
2,
"always",
[
"build",
"ci",
"chore",
"docs",
"feat",
"fix",
"perf",
"refactor",
"revert",
"test",
"style"
]
]
}
},
"lint-staged": {
"**/*.js": [
"prettier --cache --write",
"eslint",
"pnpm lint:license:staged"
],
"**/*.scss": [
"prettier --cache --write",
"stylelint --report-needless-disables --report-invalid-scope-disables --allow-empty-input",
"pnpm lint:license:staged"
],
"*.md": [
"prettier --cache --write"
]
},
"eslintConfig": {
"extends": [
"eslint-config-carbon/base"
]
},
"stylelint": {
"extends": [
"stylelint-config-carbon"
]
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,29 @@ import '../extended-button';
import { html } from 'lit';
import ArrowRight16 from '@carbon/web-components/es/icons/arrow--right/16';

// More on how to set up stories at: https://storybook.js.org/docs/web-components/writing-stories/introduction
/**
* More on how to set up stories at: https://storybook.js.org/docs/web-components/writing-stories/introduction
*/
export default {
title: 'Components/Extended button',
tags: ['autodocs'],
};

// More on writing stories with args: https://storybook.js.org/docs/web-components/writing-stories/args
/**
* More on writing stories with args: https://storybook.js.org/docs/web-components/writing-stories/args
*
* @type {{args: {label: string}, render: (function(*): TemplateResult<1>)}}
*/
export const Default = {
args: {
label: 'Extended button',
},

/**
* Renders the template for Storybook
* @param {object} args Storybook arguments
* @returns {TemplateResult<1>}
*/
render: (args) =>
html` <c4ai-extended-button>
${args.label}${ArrowRight16({ slot: 'icon' })}
Expand Down
5 changes: 5 additions & 0 deletions src/components/test-input/__stories__/test-input.stories.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,10 @@ export default {
};

export const Default = {
/**
* Renders the template for Storybook
*
* @returns {TemplateResult<1>}
*/
render: () => html` <c4ai-test-input> </c4ai-test-input>`,
};
3 changes: 3 additions & 0 deletions src/components/test-input/src/test-input.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ export default class testInput extends LitElement {
searchResults: { attribute: false },
};

/**
* Class Constructor
*/
constructor() {
super();
this.searchResults;
Expand Down
5 changes: 5 additions & 0 deletions src/components/test-input/test-input.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,11 @@ const { stablePrefix: c4aiPrefix } = settings;
* Constructed class functionality for the test input custom element
*/
class C4AITestInput extends testInput {
/**
* Renders the template while passing in class functionality
*
* @returns {TemplateResult<1>}
*/
render() {
return testInputTemplate(this);
}
Expand Down
3 changes: 3 additions & 0 deletions src/services/SearchTypeahead/SearchTypeahead.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ const _host =
*/
const _endpoint = `${_host}/search/typeahead/v1`;

/**
* Search Typeahead API class
*/
class SearchTypeaheadAPI {
/**
* Gets search results
Expand Down

0 comments on commit 8523165

Please sign in to comment.