Skip to content

Commit

Permalink
fix: linting
Browse files Browse the repository at this point in the history
  • Loading branch information
kyubisation committed Apr 9, 2024
1 parent ee91566 commit cc54154
Show file tree
Hide file tree
Showing 68 changed files with 141 additions and 122 deletions.
24 changes: 12 additions & 12 deletions .github/ISSUE_TEMPLATE/bug-report.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,22 +30,22 @@ body:
attributes:
label: Bug type
options:
- 'Functionality'
- 'Accessibility'
- 'Performance'
- 'Security vulnerability'
- 'Other'
- Functionality
- Accessibility
- Performance
- Security vulnerability
- Other
validations:
required: true
- type: dropdown
id: component-or-design-token
attributes:
label: It affects the following packages
options:
- 'Design Tokens'
- 'Components'
- 'Both'
- 'Other'
- Design Tokens
- Components
- Both
- Other
validations:
required: true
- type: input
Expand Down Expand Up @@ -78,9 +78,9 @@ body:
attributes:
label: Input mode
options:
- 'Mouse/Keyboard'
- 'Touch'
- 'Other'
- Mouse/Keyboard
- Touch
- Other
validations:
required: false
- type: input
Expand Down
10 changes: 5 additions & 5 deletions .github/ISSUE_TEMPLATE/contributing-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,19 +25,19 @@ body:
attributes:
label: Contribution type
options:
- 'Contribute a new component'
- 'Contribute an enhancement of a component'
- Contribute a new component
- Contribute an enhancement of a component
validations:
required: true
- type: dropdown
id: component-or-design-token
attributes:
label: It affects the following packages
options:
- 'Design Tokens'
- 'Components'
- Design Tokens
- Components
- 'Design Tokens & Components'
- 'Other'
- Other
validations:
required: true
- type: textarea
Expand Down
10 changes: 5 additions & 5 deletions .github/ISSUE_TEMPLATE/feature-request-or-enhancement.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,19 +25,19 @@ body:
attributes:
label: Request type
options:
- 'Request for a new component'
- 'Request for enhancement of a component'
- Request for a new component
- Request for enhancement of a component
validations:
required: true
- type: dropdown
id: component-or-design-token
attributes:
label: It affects the following packages
options:
- 'Design Tokens'
- 'Components'
- Design Tokens
- Components
- 'Design Tokens & Components'
- 'Other'
- Other
validations:
required: true
- type: textarea
Expand Down
6 changes: 3 additions & 3 deletions .github/ISSUE_TEMPLATE/question.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@ body:
attributes:
label: It affects the following packages
options:
- 'Design Tokens'
- 'Components'
- Design Tokens
- Components
- 'Design Tokens & Components'
- 'Other'
- Other
validations:
required: true
- type: input
Expand Down
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/story.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: '[Internal] Story'
description: An internal story for lyne-components
title: 'story(COMPONENT): TITLE'
labels: ['story', 'to-refine']
labels: [story, to-refine]
body:
- type: textarea
id: description
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
# the `language` matrix defined below to confirm you have the correct set of
# supported CodeQL languages.
#
name: 'CodeQL'
name: CodeQL

on:
push:
Expand All @@ -32,7 +32,7 @@ jobs:
strategy:
fail-fast: false
matrix:
language: ['javascript']
language: [javascript]
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python' ]
# Learn more:
# https://docs.github.com/en/free-pro-team@latest/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#changing-the-languages-that-are-analyzed
Expand Down Expand Up @@ -63,7 +63,7 @@ jobs:
# and modify them (or add more) to build your code if your project
# uses a compiled language

#- run: |
# - run: |
# make bootstrap
# make release

Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/continuous-integration-secure.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ name: Continuous Integration Secure
# https://securitylab.github.com/research/github-actions-preventing-pwn-requests/
on:
workflow_run:
workflows: ['Continuous Integration']
workflows: [Continuous Integration]
types: [completed]

permissions:
Expand Down Expand Up @@ -73,7 +73,7 @@ jobs:
# This label is used for filtering deployments in ArgoCD
uses: actions-ecosystem/action-add-labels@v1
with:
labels: 'preview-available'
labels: preview-available
number: ${{ env.PR_NUMBER }}

codecov:
Expand Down
22 changes: 11 additions & 11 deletions .github/workflows/continuous-integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ jobs:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'
cache: 'yarn'
node-version-file: .nvmrc
cache: yarn
- run: yarn install --frozen-lockfile --non-interactive

- name: Run eslint
Expand All @@ -27,8 +27,8 @@ jobs:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'
cache: 'yarn'
node-version-file: .nvmrc
cache: yarn
- run: yarn install --frozen-lockfile --non-interactive

- name: 'Integrity: Verify workspace integrity'
Expand All @@ -42,8 +42,8 @@ jobs:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'
cache: 'yarn'
node-version-file: .nvmrc
cache: yarn
- run: yarn install --frozen-lockfile --non-interactive

- name: Install browser dependencies
Expand All @@ -52,7 +52,7 @@ jobs:
run: yarn test
env:
NODE_ENV: production
- name: 'Assert no new snapshots (run `yarn test --ci` if this fails)'
- name: Assert no new snapshots (run `yarn test --ci` if this fails)
run: git diff --exit-code
- name: Store coverage
if: github.event_name == 'pull_request'
Expand All @@ -67,8 +67,8 @@ jobs:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'
cache: 'yarn'
node-version-file: .nvmrc
cache: yarn
- run: yarn install --frozen-lockfile --non-interactive

- name: Run build
Expand Down Expand Up @@ -124,8 +124,8 @@ jobs:
fetch-depth: 0
- uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'
cache: 'yarn'
node-version-file: .nvmrc
cache: yarn
- run: yarn install --frozen-lockfile --non-interactive
- name: Generate chromatic stories
run: yarn generate:chromatic-stories
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/pr-title-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ jobs:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'
cache: 'yarn'
node-version-file: .nvmrc
cache: yarn
- run: yarn install --frozen-lockfile --non-interactive

- name: 'Lint: Pull request title'
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/preview-image-cleanup.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,6 @@ jobs:
}
- uses: actions/delete-package-versions@v4
with:
package-name: 'lyne-components/storybook-preview'
package-type: 'container'
package-name: lyne-components/storybook-preview
package-type: container
delete-only-untagged-versions: 'true'
8 changes: 4 additions & 4 deletions .github/workflows/release-please.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ jobs:
fetch-depth: 0
- uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'
cache: 'yarn'
node-version-file: .nvmrc
cache: yarn
registry-url: 'https://registry.npmjs.org'
scope: sbb-esta
- run: yarn install --frozen-lockfile --non-interactive
Expand Down Expand Up @@ -106,8 +106,8 @@ jobs:
fetch-depth: 0
- uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'
cache: 'yarn'
node-version-file: .nvmrc
cache: yarn
- run: yarn install --frozen-lockfile --non-interactive

- name: Run build
Expand Down
2 changes: 1 addition & 1 deletion .storybook/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ const config: StorybookConfig = {
sourcemap: false,
rollupOptions: {
output: {
manualChunks(id) {
manualChunks(_id) {
return 'main';
},
},
Expand Down
2 changes: 1 addition & 1 deletion .storybook/manager.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { addons } from '@storybook/manager-api';
import theme from './theme';
import theme from './theme.js';

addons.setConfig({
enableShortcuts: false,
Expand Down
3 changes: 2 additions & 1 deletion .storybook/preview.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import * as tokens from '@sbb-esta/lyne-design-tokens';
import '../src/components/core/styles/global.scss';

const getViewportName = (key: string) => key.replace(/(^SbbBreakpoint|Min$)/g, '').toLowerCase();
const getViewportName = (key: string): string =>
key.replace(/(^SbbBreakpoint|Min$)/g, '').toLowerCase();
const breakpoints = Object.entries(tokens)
.filter(([key]) => key.startsWith('SbbBreakpoint') && key.endsWith('Min'))
.map(([key, value]) => ({ key: getViewportName(key), value: value as number }))
Expand Down
21 changes: 16 additions & 5 deletions eslint.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import tseslint from 'typescript-eslint';
import eslintConfigPrettier from 'eslint-config-prettier';
import eslintPluginYml from 'eslint-plugin-yml';
import eslint from '@eslint/js';
import { parse, parseForESLint } from '@typescript-eslint/parser';
const eslintPluginLyne = await import('./tools/eslint/index.ts');

const compat = new FlatCompat({
Expand All @@ -26,9 +25,7 @@ export default [
},
{
languageOptions: {
globals: { ...globals.browser },
ecmaVersion: 2020,
parser: { parse, parseForESLint },
globals: { ...globals.browser, ...globals.node },
},
},
{
Expand Down Expand Up @@ -132,6 +129,20 @@ export default [
camelcase: 'off',
},
},

{
files: ['**/*.stories.ts'],
rules: {
'@typescript-eslint/naming-convention': 'off',
},
},
{
files: ['**/*.js'],
rules: {
'import-x/namespace': 'off',
'import-x/default': 'off',
'import-x/no-named-as-default': 'off',
'import-x/no-named-as-default-member': 'off',
},
},
eslintConfigPrettier,
];
2 changes: 1 addition & 1 deletion scripts/chromatic-stories-generator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { readdirSync, readFileSync, writeFileSync } from 'fs';
import { basename, dirname, join, relative } from 'path';
import { fileURLToPath } from 'url';

import ts from 'typescript';
import * as ts from 'typescript';

const chromaticFile = join(
dirname(fileURLToPath(import.meta.url)),
Expand Down
1 change: 1 addition & 0 deletions scripts/clean-storybook-files.cjs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* eslint-disable @typescript-eslint/no-var-requires */
const fs = require('fs'),
path = require('path'),
allowedExtensions =
Expand Down
1 change: 1 addition & 0 deletions scripts/docs_generate.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/**
* Docs: https://github.com/open-wc/custom-elements-manifest/tree/master/packages/to-markdown
*/
/* eslint-disable import-x/namespace, import-x/default, import-x/no-named-as-default, import-x/no-named-as-default-member */
import fs from 'fs';

import { customElementsManifestToMarkdown } from '@custom-elements-manifest/to-markdown';
Expand Down
2 changes: 1 addition & 1 deletion scripts/migrate-ssr-e2e.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { basename, dirname, join, relative } from 'path';
import * as glob from 'glob';
// eslint-disable-next-line @typescript-eslint/naming-convention
import MagicString from 'magic-string';
import ts from 'typescript';
import * as ts from 'typescript';

/*
* Convert e2e test files to use the lit fixture, to enable ssr testing.
Expand Down
2 changes: 1 addition & 1 deletion scripts/migrate-toggle-data-entry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { readFileSync, writeFileSync } from 'fs';
import * as glob from 'glob';
// eslint-disable-next-line @typescript-eslint/naming-convention
import MagicString from 'magic-string';
import ts from 'typescript';
import * as ts from 'typescript';

function* iterate(node: ts.Node): Generator<ts.Node, void, unknown> {
yield node;
Expand Down
1 change: 0 additions & 1 deletion src/components/alert/alert-group/alert-group.ts
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,6 @@ export class SbbAlertGroupElement extends LitElement {
<slot @slotchange=${(event: Event) => this._slotChanged(event)}></slot>
</div>
`;
/* eslint-disable lit/binding-positions */
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/components/autocomplete/autocomplete.stories.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import type {
Decorator,
StoryContext,
} from '@storybook/web-components';
import isChromatic from 'chromatic';
import isChromatic from 'chromatic/isChromatic';
import type { TemplateResult } from 'lit';
import { html } from 'lit';
import { styleMap } from 'lit/directives/style-map.js';
Expand Down
Loading

0 comments on commit cc54154

Please sign in to comment.