Skip to content

Commit

Permalink
chore: pipeline and commit hook linters are synced (#195)
Browse files Browse the repository at this point in the history
  • Loading branch information
muratcorlu authored Sep 2, 2022
1 parent 9fd294c commit 2ad6dfb
Show file tree
Hide file tree
Showing 11 changed files with 223 additions and 1,032 deletions.
38 changes: 21 additions & 17 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,17 +1,12 @@
module.exports = {
root: true,
parser: '@typescript-eslint/parser',
parserOptions: {
ecmaVersion: 2020,
sourceType: 'module',
},
extends: [
'prettier',
'eslint:recommended',
'plugin:@typescript-eslint/eslint-recommended',
'plugin:@typescript-eslint/recommended',
],
plugins: ['@typescript-eslint'],
env: {
browser: true,
},
Expand All @@ -23,21 +18,30 @@ module.exports = {
},
overrides: [
{
files: ['rollup.config.js', 'web-test-runner.config.js'],
env: {
node: true,
},
},
{
files: [
'*.test.ts',
'**/custom_typings/*.ts',
'packages/lit-ssr/src/test/integration/tests/**',
'packages/lit-ssr/src/lib/util/parse5-utils.ts',
files: ['*.ts'],
parser: '@typescript-eslint/parser',
extends: [
'plugin:@typescript-eslint/recommended'
],
rules: {
'@typescript-eslint/no-explicit-any': 'off',
"@typescript-eslint/indent": [
"error",
2,
{
"ignoredNodes": [
"PropertyDefinition[decorators]",
"TSUnionType"
]
}
],
},
plugins: ['@typescript-eslint'],
},
{
files: ['web-test-runner.config.js'],
env: {
node: true,
},
}
],
};
9 changes: 0 additions & 9 deletions .lintstagedrc

This file was deleted.

5 changes: 5 additions & 0 deletions .lintstagedrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
module.exports = {
'*.ts': () => 'tsc -p tsconfig.json --noEmit',
'*.{ts,js}': () => 'eslint .',
'*.css': () => 'stylelint src/**/*.css'
};
5 changes: 4 additions & 1 deletion .stylelintrc.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
{
"extends": ["stylelint-config-standard", "stylelint-config-prettier"]
"extends": ["stylelint-config-standard", "stylelint-config-prettier"],
"rules": {
"custom-property-no-missing-var-function": true
}
}
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import { Meta } from '@storybook/addon-docs';
import createBranchImage from './images/create-branch-in-vscode.png';
import iconsFolderImage from './images/icons-folder.png';
import stageFilesImage from './images/stage-files.png';
import filesStagedImage from './images/files-staged.png';
import commitPushImage from './images/commit-and-push.png';
import openPrImage from './images/open-pr.png';
import prFormImage from './images/pr-form.png';
import createBranchImage from '../images/create-branch-in-vscode.png';
import iconsFolderImage from '../images/icons-folder.png';
import stageFilesImage from '../images/stage-files.png';
import filesStagedImage from '../images/files-staged.png';
import commitPushImage from '../images/commit-and-push.png';
import openPrImage from '../images/open-pr.png';
import prFormImage from '../images/pr-form.png';

<Meta
title="Documentation/Adding New Icons"
title="Design System/Icons/Adding New Icons"
parameters={{
viewMode: 'docs',
previewTabs: {
Expand Down
2 changes: 1 addition & 1 deletion docs/design-system/iconography.stories.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { Meta, Title, IconGallery, IconItem } from '@storybook/addon-docs';
import icons from '../../src/components/icon/icon-list';

<Meta
title="Design System/Iconography"
title="Design System/Icons/Iconography"
parameters={{
viewMode: 'docs',
previewTabs: {
Expand Down
21 changes: 15 additions & 6 deletions docs/linting.stories.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,20 @@ import { Meta } from '@storybook/addon-docs';
}}
/>

# Baklava testing
# Linters & Formatters

> This guide will help contributors about how to lint Baklava.
To keep a consistent codebase we use some linters and running them in our pipelines automatically.

### Brief
- To lint, we are using `tsc`, `eslint`, `prettier` and `stylelint`.
- To get more information, you can find our configurations at [tsconfig.json](https://github.com/Trendyol/baklava/blob/next/tsconfig.json), [.prettier.json](https://github.com/Trendyol/baklava/blob/next/.prettier.json), [.eslintrc.json](https://github.com/Trendyol/baklava/blob/next/.eslintrc.json) and [stylelintrc.json](https://github.com/Trendyol/baklava/blob/next/stylelintrc.json).
- To run linters, you can simply type `npm run lint` and run.
Linters that we use are [`eslint`](https://eslint.org), [`stylelint`](https://stylelint.io) and
[`commitlint`](https://commitlint.js.org). When make a git commit, some staged files processed with linters (via
[`husky`](https://typicode.github.io/husky/)) to check some syntax issues. `eslint` run for `ts` and `js` files and
`stylelint` run for `css` files. Also we check commit message with `commitlint`. [More information about our commit
rules](/docs/documentation-commit-rules--page). If there are any issues commit will be
interrupted with the message.

Same rules also apply in pipeline flow for every push. In the pipelines, we run `npm run lint` which is doing same
checks for all of the files this time and makes sure this push doesn't break any coding rules that we have.

We also use [`prettier`](https://prettier.io) and `eslint` as a formatter to easily fix some linting issues. You can
run `npm run format` to fix some issues automatically. We don't run this command in every commit automatically because
we want to be in control what and why we are doing some fixes.
Loading

0 comments on commit 2ad6dfb

Please sign in to comment.