Skip to content

Commit ee8f3a2

Browse files
authored
chore(lint): enable comma-dangle eslint rule (#441)
1 parent bf2e922 commit ee8f3a2

File tree

13 files changed

+61
-60
lines changed

13 files changed

+61
-60
lines changed

.eslintrc.js

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,30 @@
11
module.exports = {
22
extends: [
3-
'@nuxtjs/eslint-config'
3+
'@nuxtjs/eslint-config',
44
],
55
ignorePatterns: ['dist/'],
66
rules: {
7+
'comma-dangle': ['error', 'always-multiline'],
78
'import/named': 'off',
89
'import/namespace': 'off',
910
'import/no-absolute-path': 'off',
1011
'no-console': [
1112
'error', {
12-
allow: ['assert', 'warn', 'error', 'info']
13-
}
13+
allow: ['assert', 'warn', 'error', 'info'],
14+
},
1415
],
15-
'vue/multi-word-component-names': 'off'
16+
'vue/multi-word-component-names': 'off',
1617
},
1718
overrides: [
1819
{
1920
files: ['test/**'],
2021
plugins: ['jest'],
21-
extends: ['plugin:jest/recommended']
22+
extends: ['plugin:jest/recommended'],
2223
},
2324
{
2425
files: ['*.ts', '*.tsx'],
2526
extends: [
26-
'@nuxtjs/eslint-config-typescript'
27+
'@nuxtjs/eslint-config-typescript',
2728
],
2829
rules: {
2930
'constructor-super': 'off', // ts(2335) & ts(2377)
@@ -77,8 +78,8 @@ module.exports = {
7778
'@typescript-eslint/prefer-namespace-keyword': 'error',
7879
'@typescript-eslint/quotes': ['error', 'single', { avoidEscape: true, allowTemplateLiterals: false }],
7980
'@typescript-eslint/semi': ['error', 'never'],
80-
'@typescript-eslint/triple-slash-reference': 'error'
81-
}
82-
}
83-
]
81+
'@typescript-eslint/triple-slash-reference': 'error',
82+
},
83+
},
84+
],
8485
}

lib/core/hooks.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ export async function buildHook (moduleContainer, moduleOptions, logger) {
2323
src: resolve(__dirname, '..', `plugin.${pluginOptionClient}.js`),
2424
fileName: 'sentry.client.js',
2525
mode: 'client',
26-
options: clientOptions
26+
options: clientOptions,
2727
})
2828

2929
const pluginOptionServer = serverSentryEnabled(moduleOptions) ? 'server' : 'mocked'
@@ -32,14 +32,14 @@ export async function buildHook (moduleContainer, moduleOptions, logger) {
3232
src: resolve(__dirname, '..', `plugin.${pluginOptionServer}.js`),
3333
fileName: 'sentry.server.js',
3434
mode: 'server',
35-
options: serverOptions
35+
options: serverOptions,
3636
})
3737

3838
if (serverSentryEnabled(moduleOptions)) {
3939
moduleContainer.addTemplate({
4040
src: resolve(__dirname, '..', 'templates', 'options.ejs'),
4141
fileName: RESOLVED_RELEASE_FILENAME,
42-
options: { release }
42+
options: { release },
4343
})
4444
}
4545
}

lib/core/options.js

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ function resolveLazyOptions (options, apiMethods, logger) {
5757
mockApiMethods: true,
5858
chunkName: 'sentry',
5959
webpackPrefetch: false,
60-
webpackPreload: false
60+
webpackPreload: false,
6161
}
6262

6363
options.lazy = /** @type {Required<import('../../types/sentry').LazyConfiguration>} */(
@@ -97,10 +97,10 @@ function resolveTracingOptions (options) {
9797
tracingOptions: {
9898
hooks: ['mount', 'update'],
9999
timeout: 2000,
100-
trackComponents: true
101-
}
100+
trackComponents: true,
101+
},
102102
},
103-
browserOptions: {}
103+
browserOptions: {},
104104
}, typeof options.tracing === 'boolean' ? {} : options.tracing)
105105
if (!options.config.tracesSampleRate) {
106106
options.config.tracesSampleRate = options.tracing.tracesSampleRate
@@ -147,7 +147,7 @@ export async function resolveClientOptions (moduleContainer, moduleOptions, logg
147147
runtimeConfigKey: options.runtimeConfigKey,
148148
config: {
149149
dsn: options.dsn,
150-
...options.clientConfig
150+
...options.clientConfig,
151151
},
152152
lazy: options.lazy,
153153
apiMethods,
@@ -160,7 +160,7 @@ export async function resolveClientOptions (moduleContainer, moduleOptions, logg
160160
// @ts-ignore
161161
res[key] = options.clientIntegrations[key]
162162
return res
163-
}, {})
163+
}, {}),
164164
}
165165
}
166166

@@ -199,8 +199,8 @@ export async function resolveServerOptions (moduleContainer, moduleOptions, logg
199199
// @ts-ignore
200200
return Object.keys(opt).length ? new Integrations[name](opt) : new Integrations[name]()
201201
}),
202-
...customIntegrations
203-
]
202+
...customIntegrations,
203+
],
204204
}
205205
options.config = merge(defaultConfig, options.config, options.serverConfig)
206206

@@ -218,6 +218,6 @@ export async function resolveServerOptions (moduleContainer, moduleOptions, logg
218218
config: options.config,
219219
apiMethods,
220220
lazy: options.lazy,
221-
logMockCalls: options.logMockCalls // for mocked only
221+
logMockCalls: options.logMockCalls, // for mocked only
222222
}
223223
}

lib/module.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -35,32 +35,32 @@ export default function SentryModule (moduleOptions) {
3535
ExtraErrorData: {},
3636
ReportingObserver: {},
3737
RewriteFrames: {},
38-
Vue: { attachProps: true, logErrors: this.options.dev }
38+
Vue: { attachProps: true, logErrors: this.options.dev },
3939
},
4040
serverIntegrations: {
4141
Dedupe: {},
4242
ExtraErrorData: {},
4343
RewriteFrames: {},
44-
Transaction: {}
44+
Transaction: {},
4545
},
4646
customClientIntegrations: '',
4747
customServerIntegrations: '',
4848
config: {
49-
environment: this.options.dev ? 'development' : 'production'
49+
environment: this.options.dev ? 'development' : 'production',
5050
},
5151
serverConfig: {},
5252
clientConfig: {},
53-
requestHandlerConfig: {}
53+
requestHandlerConfig: {},
5454
}
5555

5656
/** @type {import('@sentry/webpack-plugin').SentryCliPluginOptions} */
5757
const defaultsPublishRelease = {
5858
include: [],
5959
ignore: [
6060
'node_modules',
61-
'.nuxt/dist/client/img'
61+
'.nuxt/dist/client/img',
6262
],
63-
configFile: '.sentryclirc'
63+
configFile: '.sentryclirc',
6464
}
6565

6666
const topLevelOptions = this.options.sentry || {}

lib/plugin.client.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ export default async function (ctx, inject) {
2727
typeof option === 'function'
2828
? `${key}:${serializeFunction(option)}`
2929
: `${key}:${serialize(option)}`
30-
).join(',\n ') %>
30+
).join(',\n ') %>,
3131
}
3232

3333
const runtimeConfigKey = <%= serialize(options.runtimeConfigKey) %>
@@ -51,7 +51,7 @@ export default async function (ctx, inject) {
5151
)
5252

5353
return `new ${name}(${integrationOptions.length ? '{' + integrationOptions.join(',') + '}' : ''})`
54-
}).join(',\n ')%>
54+
}).join(',\n ')%>,
5555
]
5656
<% if (options.tracing) { %>
5757
config.integrations.push(<%= `new TracingIntegrations.BrowserTracing(${serialize(options.tracing.browserOptions)})` %>)

lib/plugin.lazy.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ async function loadSentry (ctx, inject) {
142142
)
143143

144144
return `new ${name}(${integrationOptions.length ? '{' + integrationOptions.join(',') + '}' : ''})`
145-
}).join(',\n ')%>
145+
}).join(',\n ')%>,
146146
]
147147
<%if (options.customClientIntegrations) {%>
148148
const customIntegrations = (await import(/* <%= magicComments.join(', ') %> */ '<%= options.customClientIntegrations %>').then(m => m.default || m))(ctx)

test/fixture/default/nuxt.config.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,28 +5,28 @@ const config = {
55
rootDir: __dirname,
66
telemetry: false,
77
build: {
8-
terser: false
8+
terser: false,
99
},
1010
render: {
11-
resourceHints: false
11+
resourceHints: false,
1212
},
1313
modules: [
1414
// @ts-ignore
15-
SentryModule
15+
SentryModule,
1616
],
1717
sentry: {
1818
clientIntegrations: {
1919
// Integration from @Sentry/browser package.
20-
TryCatch: { eventTarget: false }
20+
TryCatch: { eventTarget: false },
2121
},
2222
customClientIntegrations: '~/config/custom-client-integrations.js',
2323
publishRelease: {
2424
authToken: 'fakeToken',
2525
org: 'MyCompany',
2626
project: 'TestProject',
27-
dryRun: true
28-
}
29-
}
27+
dryRun: true,
28+
},
29+
},
3030
}
3131

3232
module.exports = config

test/fixture/default/pages/index.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,13 @@ export default {
1414
/** @type {import('@sentry/minimal') | null} */
1515
clientSentry: null,
1616
/** @type {import('@sentry/minimal') | null} */
17-
serverSentry: this.$sentry
17+
serverSentry: this.$sentry,
1818
}
1919
},
2020
created () {
2121
if (process.client) {
2222
this.clientSentry = this.$sentry
2323
}
24-
}
24+
},
2525
}
2626
</script>

test/fixture/lazy/nuxt.config.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,29 +6,29 @@ const config = {
66
telemetry: false,
77
dev: false,
88
render: {
9-
resourceHints: false
9+
resourceHints: false,
1010
},
1111
modules: [
1212
// @ts-ignore
13-
SentryModule
13+
SentryModule,
1414
],
1515
sentry: {
1616
lazy: true,
1717
dsn: 'https://[email protected]/1429779',
1818
config: {},
1919
clientIntegrations: {
2020
// Integration from @Sentry/browser package.
21-
TryCatch: { eventTarget: false }
21+
TryCatch: { eventTarget: false },
2222
},
23-
customClientIntegrations: '~/config/custom-client-integrations.js'
23+
customClientIntegrations: '~/config/custom-client-integrations.js',
2424
},
2525
publicRuntimeConfig: {
2626
sentry: {
2727
config: {
28-
environment: 'production'
29-
}
30-
}
31-
}
28+
environment: 'production',
29+
},
30+
},
31+
},
3232
}
3333

3434
module.exports = config

test/fixture/lazy/pages/index.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ export default {
1313
return {
1414
isSentryReady: false,
1515
/** @type {import('@sentry/minimal') | null} */
16-
serverSentry: this.$sentry
16+
serverSentry: this.$sentry,
1717
}
1818
},
1919
created () {
@@ -24,6 +24,6 @@ export default {
2424
},
2525
mounted () {
2626
this.$sentry.captureMessage('Hi!')
27-
}
27+
},
2828
}
2929
</script>

0 commit comments

Comments
 (0)