Skip to content

Commit

Permalink
chore: remove split linting (#2582)
Browse files Browse the repository at this point in the history
A while back we decided we wanted a split linting environment (#1179) which we did alongside other improvements in #2545.

Since then we've decided to stick to one single linting environment, i.e. the stricter one. But we still only want to apply fixes on pre-commit and not in CI (CI should fail not fix).

---

I also noticed that:

- We needed `console.info` (you can see usage in  #2531), so aswell as adding that I changed the `console.log`s we used in a cypress config to use `console.info` instead.
- `npm install` was being passed `--frozen-lockfile` which is a `yarn` argument, it should be `npm clean-install`


Signed-off-by: John Cowen <john.cowen@konghq.com>
  • Loading branch information
johncowen authored May 22, 2024
1 parent 5365bbe commit b60c43a
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 37 deletions.
4 changes: 2 additions & 2 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ const INLINE_NON_VOID_ELEMENTS = [
caseInsensitive: true,
},
}],
'no-console': 'off',
'no-console': ['error', { allow: ['info', 'warn', 'error'] }],
},
overrides: [
{
Expand Down Expand Up @@ -153,7 +153,7 @@ const INLINE_NON_VOID_ELEMENTS = [
'@typescript-eslint/func-call-spacing': 'error',

'no-unused-vars': 'off',
'@typescript-eslint/no-unused-vars': [process.env.LINTER_MODE === 'strict' ? 'error' : 'warn', {
'@typescript-eslint/no-unused-vars': ['error', {
argsIgnorePattern: '^_',
varsIgnorePattern: '^_',
ignoreRestSiblings: true,
Expand Down
19 changes: 0 additions & 19 deletions .eslintrc.production.cjs

This file was deleted.

14 changes: 4 additions & 10 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,7 @@ jobs:
key: ${{ runner.os }}-node-modules-${{ hashFiles('**/package-lock.json') }}
- if: steps.node-modules-cache.outputs.cache-hit != 'true'
run: |
npm install --frozen-lockfile
npm run lint:lockfile
npm clean-install
- id: set-groups
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
env:
Expand All @@ -62,12 +61,8 @@ jobs:
**/node_modules
/home/runner/.cache/Cypress
key: ${{ runner.os }}-node-modules-${{ hashFiles('**/package-lock.json') }}
- env:
LINTER_MODE: strict
run: |
npm run lint -- --config .eslintrc.production.cjs
npm run lint:ts
npm run lint:styles
- run: |
make lint
cli-tests:
needs: [install-dependencies]
Expand All @@ -84,7 +79,7 @@ jobs:
/home/runner/.cache/Cypress
key: ${{ runner.os }}-node-modules-${{ hashFiles('**/package-lock.json') }}
- run: |
npm run test
make test/unit
browser-tests:
needs: [install-dependencies]
Expand Down Expand Up @@ -140,5 +135,4 @@ jobs:
contains(needs.*.result, 'failure') ||
contains(needs.*.result, 'cancelled')
run: echo '${{toJSON(needs)}}' && exit 1

- run: echo "Successful"
4 changes: 2 additions & 2 deletions .lintstagedrc.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"*.{js,ts,vue}": "eslint --config .eslintrc.production.cjs --fix",
"*.{js,ts,vue}": "eslint --fix",
"*.{css,scss,vue}": "stylelint --allow-empty-input --fix"
}
}
7 changes: 4 additions & 3 deletions cypress.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ function createVuePlugin(
},
}
}
const env = dotenv.config().parsed as {[key: string]: string}
const env = dotenv.config().parsed as { [key: string]: string }

Object.entries({
// default base URL for testing against
Expand Down Expand Up @@ -49,7 +49,8 @@ export default defineConfig({

on('task', {
log(message: unknown) {
console.log(JSON.stringify(message))
console.info(JSON.stringify(message))

return null
},
})
Expand Down Expand Up @@ -81,7 +82,7 @@ export default defineConfig({
.replace(/^> /, '')
const newLineIndex = trimmedMessage.indexOf('\n')
const message = trimmedMessage.substring(0, newLineIndex !== -1 ? newLineIndex : trimmedMessage.length)
console.log(`::error file=${results.spec.relative}::${message}`)
console.info(`::error file=${results.spec.relative}::${message}`)
}
}
}
Expand Down
1 change: 1 addition & 0 deletions mk/check.mk
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,5 @@ lint: ## Dev: Run lint checks on all languages
@$(MAKE) run/lint
@$(MAKE) run/lint:ts
@$(MAKE) run/lint:styles
@$(MAKE) run/lint:lockfile

2 changes: 1 addition & 1 deletion src/app/x/components/x-copy-button/XCopyButtonDebug.vue
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<template>
<CopyButton
:text="props.text"
@mouseup="(e) => {
@mouseup="() => {
createCopy(() => {})(props.text)
}"
>
Expand Down

0 comments on commit b60c43a

Please sign in to comment.