Skip to content

Commit

Permalink
chore: update to eslint 9 and modern config (#700)
Browse files Browse the repository at this point in the history
  • Loading branch information
rchl authored Oct 7, 2024
1 parent 8fd55ab commit e589e73
Show file tree
Hide file tree
Showing 34 changed files with 533 additions and 852 deletions.
11 changes: 0 additions & 11 deletions .eslintignore

This file was deleted.

107 changes: 0 additions & 107 deletions .eslintrc.cjs

This file was deleted.

2 changes: 0 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,5 +33,3 @@ jobs:
- name: Linting
if: ${{ matrix.node-version == '18' }}
run: yarn lint
- name: Coverage
run: yarn coverage
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ dist

# Testing
reports
coverage
*.lcov
.nyc_output

Expand Down
2 changes: 1 addition & 1 deletion .size-limit.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,4 @@ module.exports = [
gzip: false,
brotli: false,
},
];
]
3 changes: 0 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

[![npm version][npm-version-src]][npm-version-href]
[![npm downloads][npm-downloads-src]][npm-downloads-href]
[![Codecov][codecov-src]][codecov-href]
[![Standard JS][standard-js-src]][standard-js-href]

> [Sentry](http://sentry.io) module for [Nuxt 2](https://v2.nuxt.com/). For [Nuxt 3+](https://nuxt.com/) support see the official [`@sentry/nuxt` module](https://docs.sentry.io/platforms/javascript/guides/nuxt/).
Expand All @@ -28,7 +27,5 @@
[npm-version-href]: https://npmjs.com/package/@nuxtjs/sentry
[npm-downloads-src]: https://img.shields.io/npm/v/@nuxtjs/sentry/latest.svg?style=flat-square
[npm-downloads-href]: https://npmjs.com/package/@nuxtjs/sentry
[codecov-src]: https://img.shields.io/codecov/c/github/nuxt-community/sentry-module.svg?style=flat-square
[codecov-href]: https://codecov.io/gh/nuxt-community/sentry-module
[standard-js-src]: https://img.shields.io/badge/code_style-standard-brightgreen.svg?style=flat-square
[standard-js-href]: https://standardjs.com
1 change: 0 additions & 1 deletion docs/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ node_modules
.nuxt
.vscode
.DS_Store
coverage
dist
sw.*
.env
68 changes: 68 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
import base from 'eslint-config-rchl-base'
import typescript from 'eslint-config-rchl-typescript'
import vue from 'eslint-config-rchl-vue'

/** @type {import('eslint').Linter.Config[]} */
export default [
{
ignores: [
'**/.nuxt/',
'**/dist/',
'**/templates/',
'node_modules/',
],
},
...base,
...typescript,
...vue,
{
rules: {
'@stylistic/indent': [
'error', 2, {
SwitchCase: 1,
},
],
'@stylistic/semi': ['error', 'never'],
'@stylistic/space-before-function-paren': ['error', 'always'],
},
},
{
files: ['**/*.ts', '**/*.tsx'],
rules: {
'@stylistic/ts/indent': [
'error', 2, {
SwitchCase: 1,
FunctionDeclaration: { parameters: 'first' },
FunctionExpression: { parameters: 'first' },
CallExpression: { arguments: 'first' },
},
],
'@stylistic/ts/member-delimiter-style': [
'error', {
multiline: {
delimiter: 'none',
},
},
],
'@stylistic/ts/semi': ['error', 'never'],
'@stylistic/ts/space-before-function-paren': ['error', 'always'],
},
},
{
files: ['**/*.vue'],
rules: {
'vue/html-indent': ['error', 2],
'vue/script-indent': ['error', 2, { switchCase: 1 }],
},
},
{
files: ['**/.nuxt/*.js'],
rules: {
'@stylistic/comma-spacing': 'off',
'@stylistic/key-spacing': 'off',
'@stylistic/object-curly-spacing': 'off',
'@stylistic/quote-props': 'off',
'@stylistic/quotes': 'off',
},
},
]
16 changes: 8 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,14 +39,13 @@
"dev:generate": "nuxt generate -c ./test/fixture/default/nuxt.config --force-build",
"analyze": "node ./node_modules/nuxt/bin/nuxt.js build --analyze -c ./test/fixture/default/nuxt.config",
"size": "yarn build && cd size-check && yarn build && cd .. && yarn size-limit",
"lint": "eslint --ext .vue,.js,.ts .",
"lint:fix": "eslint --ext .vue,.js,.ts . --fix",
"lint:fixture": "eslint --ext .vue,.js --no-ignore 'test/fixture/*/.nuxt/sentry.*'",
"lint": "eslint .",
"lint:fix": "eslint . --fix",
"lint:fixture": "eslint --no-ignore 'test/fixture/*/.nuxt/sentry.*'",
"release": "release-it",
"test": "yarn prepack && vitest run --poolOptions.threads.singleThread && yarn lint:fixture && yarn typecheck",
"test:watch": "vitest",
"typecheck": "yarn dev:prepare && tsc && tsc -p ./test/tsconfig.json",
"coverage": "codecov"
"typecheck": "yarn dev:prepare && tsc && tsc -p ./test/tsconfig.json"
},
"lint-staged": {
"*.{js,ts,vue}": [
Expand Down Expand Up @@ -77,7 +76,6 @@
"@nuxt/module-builder": "0.8.3",
"@nuxt/types": "2.18.1",
"@nuxt/typescript-build": "^3.0.2",
"@nuxtjs/eslint-config-typescript": "12.1.0",
"@nuxtjs/module-test-utils": "1.6.3",
"@release-it/conventional-changelog": "8.0.1",
"@sentry/profiling-node": "7.119.0",
Expand All @@ -87,8 +85,10 @@
"@types/lodash.mergewith": "4.6.9",
"@types/node": "20.16.3",
"@types/request-promise-native": "1.0.21",
"codecov": "3.8.3",
"eslint": "8.57.0",
"eslint": "^9.12.0",
"eslint-config-rchl-base": "^2.0.3",
"eslint-config-rchl-typescript": "^3.0.2",
"eslint-config-rchl-vue": "^3.0.0",
"hookable": "5.5.3",
"husky": "4.3.8",
"lint-staged": "15.2.10",
Expand Down
2 changes: 1 addition & 1 deletion size-check/base/pages/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<h3>Client-side</h3>
<span id="client-side">{{ clientSentryPresent ? 'Works!' : '$sentry object is missing!' }}</span>
<p>
<button id="crash-button" @click="crash_me()">
<button id="crash-button" type="button" @click="crash_me()">
crash me
</button>
</p>
Expand Down
2 changes: 1 addition & 1 deletion size-check/lazy+tracing/pages/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<h3>Client-side</h3>
<span id="client-side">{{ clientSentryPresent ? 'Works!' : '$sentry object is missing!' }}</span>
<p>
<button id="crash-button" @click="crash_me()">
<button id="crash-button" type="button" @click="crash_me()">
crash me
</button>
</p>
Expand Down
2 changes: 1 addition & 1 deletion size-check/lazy/pages/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<h3>Client-side</h3>
<span id="client-side">{{ clientSentryPresent ? 'Works!' : '$sentry object is missing!' }}</span>
<p>
<button id="crash-button" @click="crash_me()">
<button id="crash-button" type="button" @click="crash_me()">
crash me
</button>
</p>
Expand Down
2 changes: 1 addition & 1 deletion size-check/replay/pages/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<h3>Client-side</h3>
<span id="client-side">{{ clientSentryPresent ? 'Works!' : '$sentry object is missing!' }}</span>
<p>
<button id="crash-button" @click="crash_me()">
<button id="crash-button" type="button" @click="crash_me()">
crash me
</button>
</p>
Expand Down
2 changes: 1 addition & 1 deletion size-check/tracing/pages/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<h3>Client-side</h3>
<span id="client-side">{{ clientSentryPresent ? 'Works!' : '$sentry object is missing!' }}</span>
<p>
<button id="crash-button" @click="crash_me()">
<button id="crash-button" type="button" @click="crash_me()">
crash me
</button>
</p>
Expand Down
3 changes: 1 addition & 2 deletions size-check/typescript/pages/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<h3>Client-side</h3>
<span id="client-side">{{ clientSentryPresent ? 'Works!' : '$sentry object is missing!' }}</span>
<p>
<button id="crash-button" @click="crash_me()">
<button id="crash-button" type="button" @click="crash_me()">
crash me
</button>
</p>
Expand All @@ -19,7 +19,6 @@ export default defineComponent({
asyncData ({ $sentry, query }) {
if (query.crashOnLoad) {
// @ts-ignore forces a crash
// eslint-disable-next-line no-undef
crashOnLoad()
}
Expand Down
4 changes: 2 additions & 2 deletions src/hooks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export async function buildHook (nuxt: Nuxt, moduleOptions: ModuleConfiguration,

const templateDir = fileURLToPath(new URL('./templates', import.meta.url))

const pluginOptionClient = clientSentryEnabled(moduleOptions) && canInitialize(moduleOptions) ? (moduleOptions.lazy ? 'lazy' : 'client') : 'mocked'
const pluginOptionClient = clientSentryEnabled(moduleOptions) && canInitialize(moduleOptions) ? moduleOptions.lazy ? 'lazy' : 'client' : 'mocked'
const clientOptions: ResolvedClientOptions = defu({ config: { release } }, await resolveClientOptions(nuxt, moduleOptions, logger))
addPluginTemplate({
src: resolve(templateDir, `plugin.${pluginOptionClient}.js`),
Expand Down Expand Up @@ -65,7 +65,7 @@ export async function buildHook (nuxt: Nuxt, moduleOptions: ModuleConfiguration,
export async function webpackConfigHook (nuxt: Nuxt, webpackConfigs: WebpackConfig[], options: ModuleConfiguration, logger: ConsolaInstance): Promise<void> {
let WebpackPlugin: typeof import('@sentry/webpack-plugin')
try {
WebpackPlugin = await (import('@sentry/webpack-plugin').then(m => m.default || m))
WebpackPlugin = await import('@sentry/webpack-plugin').then(m => m.default || m)
} catch {
throw new Error('The "@sentry/webpack-plugin" package must be installed as a dev dependency to use the "publishRelease" option.')
}
Expand Down
Loading

0 comments on commit e589e73

Please sign in to comment.