Skip to content

Commit fb0f830

Browse files
committed
style: apply ESLint formatting fixes
- Fix trailing commas and whitespace - Normalize comment spacing - No functional changes Authored by: Aaron Lippold<lippold@gmail.com>
1 parent 41b41de commit fb0f830

File tree

5 files changed

+52
-52
lines changed

5 files changed

+52
-52
lines changed

docs/.vitepress/config.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,30 +16,30 @@ export default defineConfig({
1616
// Follow symlinks for linked markdown files
1717
vite: {
1818
resolve: {
19-
preserveSymlinks: true
20-
}
19+
preserveSymlinks: true,
20+
},
2121
},
2222

2323
themeConfig: {
2424
nav: [
2525
{ text: 'Home', link: '/' },
2626
{ text: 'Quick Start', link: '/quick-start' },
27-
{
27+
{
2828
text: 'Guide',
2929
items: [
3030
{ text: 'Getting Started', link: '/guide/getting-started' },
3131
{ text: 'Vue Integration', link: '/vue-integration' },
3232
{ text: 'Examples', link: '/examples' },
33-
{ text: 'Architecture', link: '/architecture' }
34-
]
33+
{ text: 'Architecture', link: '/architecture' },
34+
],
3535
},
36-
{
36+
{
3737
text: 'API',
3838
items: [
3939
{ text: 'Configuration', link: '/api/configuration' },
4040
{ text: 'Composables', link: '/api/composables' },
41-
{ text: 'Plugin API', link: '/api/plugin' }
42-
]
41+
{ text: 'Plugin API', link: '/api/plugin' },
42+
],
4343
},
4444
{ text: 'Contributing', link: '/contributing' },
4545
],

src/runtime/plugin.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ export default defineNuxtPlugin((nuxtApp) => {
3333
// Get runtime config or use defaults
3434
const runtimeConfig = nuxtApp.$config?.public?.smartscript || {}
3535
config = mergeConfig(runtimeConfig)
36-
36+
3737
// Configure logger based on debug setting
3838
configureLogger(config.debug)
3939
logger.info('Plugin initializing...')
@@ -57,11 +57,11 @@ export default defineNuxtPlugin((nuxtApp) => {
5757
// Create patterns
5858
const patterns = createPatterns(config)
5959
const combinedPattern = createCombinedPattern(patterns, config)
60-
60+
6161
logger.debug('Patterns created:', {
6262
copyright: patterns.copyright,
6363
trademark: patterns.trademark,
64-
combinedPattern
64+
combinedPattern,
6565
})
6666

6767
// Main processing function

src/runtime/smartscript/logger.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ export const logger = createConsola({
1616
export function configureLogger(debug: boolean = false) {
1717
// In debug mode, show all logs including debug level
1818
// In production, only show info and above
19-
logger.level = debug ? 4 : 3 // 4 = debug, 3 = info
19+
logger.level = debug ? 4 : 3 // 4 = debug, 3 = info
2020
}
2121

2222
// Re-export log levels for convenience
@@ -27,4 +27,4 @@ export const LogLevel = {
2727
Info: 3,
2828
Debug: 4,
2929
Trace: 5,
30-
} as const
30+
} as const

src/runtime/smartscript/types.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
*/
44

55
export interface SuperscriptConfig {
6-
debug?: boolean // Enable debug logging
6+
debug?: boolean // Enable debug logging
77
symbols: {
88
trademark: string[]
99
registered: string[]

test/math-notation.test.ts

Lines changed: 38 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -6,61 +6,61 @@ import { DEFAULT_CONFIG } from '../src/runtime/smartscript/config'
66
describe('Mathematical Notation Support', () => {
77
const config = DEFAULT_CONFIG
88
const patterns = createPatterns(config)
9-
9+
1010
describe('LaTeX-style Notation', () => {
1111
it('should support both x_n and x_{n} formats for subscripts', () => {
1212
const pattern = patterns.mathSub
13-
13+
1414
// Single character without braces (common in math)
1515
expect('x_n'.match(pattern)).toEqual(['x_n'])
1616
expect('x_i'.match(pattern)).toEqual(['x_i'])
1717
expect('x_j'.match(pattern)).toEqual(['x_j'])
1818
expect('a_0'.match(pattern)).toEqual(['a_0'])
19-
19+
2020
// Single character with braces (also valid)
2121
expect('x_{n}'.match(pattern)).toEqual(['x_{n}'])
2222
expect('x_{i}'.match(pattern)).toEqual(['x_{i}'])
23-
23+
2424
// Multi-character requires braces
2525
expect('x_{10}'.match(pattern)).toEqual(['x_{10}'])
2626
expect('x_{n+1}'.match(pattern)).toEqual(['x_{n+1}'])
2727
expect('x_{ij}'.match(pattern)).toEqual(['x_{ij}'])
2828
})
29-
29+
3030
it('should support both x^n and x^{n} formats for superscripts', () => {
3131
const pattern = patterns.mathSuper
32-
32+
3333
// Single character without braces (common in math)
3434
expect('x^2'.match(pattern)).toEqual(['x^2'])
3535
expect('x^n'.match(pattern)).toEqual(['x^n'])
3636
expect('x^i'.match(pattern)).toEqual(['x^i'])
3737
expect('e^x'.match(pattern)).toEqual(['e^x'])
38-
38+
3939
// Single character with braces (also valid)
4040
expect('x^{2}'.match(pattern)).toEqual(['x^{2}'])
4141
expect('x^{n}'.match(pattern)).toEqual(['x^{n}'])
42-
42+
4343
// Multi-character requires braces
4444
expect('x^{10}'.match(pattern)).toEqual(['x^{10}'])
4545
expect('x^{n+1}'.match(pattern)).toEqual(['x^{n+1}'])
4646
expect('x^{-1}'.match(pattern)).toEqual(['x^{-1}'])
4747
})
4848
})
49-
49+
5050
describe('Real-world Mathematical Expressions', () => {
5151
it('should handle common mathematical sequences', () => {
5252
const combined = createCombinedPattern(patterns, config)
53-
53+
5454
const sequence = 'The sequence a_1, a_2, ..., a_n converges'
5555
const matches = sequence.match(combined)
5656
expect(matches).toContain('a_1')
5757
expect(matches).toContain('a_2')
5858
expect(matches).toContain('a_n')
5959
})
60-
60+
6161
it('should handle polynomial expressions', () => {
6262
const combined = createCombinedPattern(patterns, config)
63-
63+
6464
// Note: Without spaces, a_nx^n only matches a_n (x^n is preceded by letter n)
6565
// This is correct behavior to avoid false matches
6666
const polynomial = 'P(x) = a_0 + a_1x + a_2x^2 + ... + a_n x^n'
@@ -72,90 +72,90 @@ describe('Mathematical Notation Support', () => {
7272
expect(matches).toContain('a_n')
7373
expect(matches).toContain('x^n')
7474
})
75-
75+
7676
it('should handle matrix notation', () => {
7777
const combined = createCombinedPattern(patterns, config)
78-
78+
7979
const matrix = 'Matrix A has elements a_{ij} where i goes from 1 to m and j from 1 to n'
8080
const matches = matrix.match(combined)
8181
expect(matches).toContain('a_{ij}')
8282
})
83-
83+
8484
it('should handle exponential and logarithmic expressions', () => {
8585
const combined = createCombinedPattern(patterns, config)
86-
86+
8787
const expressions = [
8888
{ text: 'e^x is the exponential function', expected: ['e^x'] },
8989
{ text: 'e^{2x} grows faster', expected: ['e^{2x}'] },
9090
{ text: 'The function f_2(x) is defined', expected: ['f_2'] },
9191
{ text: 'Sequence a_n converges', expected: ['a_n'] },
9292
]
93-
93+
9494
expressions.forEach(({ text, expected }) => {
9595
const matches = text.match(combined)
9696
if (expected.length > 0) {
9797
expect(matches).toBeTruthy()
98-
expected.forEach(exp => {
98+
expected.forEach((exp) => {
9999
expect(matches).toContain(exp)
100100
})
101101
}
102102
})
103103
})
104104
})
105-
105+
106106
describe('Edge Cases and Non-matches', () => {
107107
it('should not match underscores in file names or identifiers', () => {
108108
const combined = createCombinedPattern(patterns, config)
109-
109+
110110
// These should NOT match the math patterns
111111
const fileNames = [
112112
'file_name.txt',
113113
'my_variable',
114114
'snake_case_function',
115115
'__init__',
116116
]
117-
118-
fileNames.forEach(name => {
117+
118+
fileNames.forEach((name) => {
119119
const matches = name.match(combined)
120120
expect(matches).toBeNull()
121121
})
122122
})
123-
123+
124124
it('should not match when pattern is incomplete', () => {
125125
const combined = createCombinedPattern(patterns, config)
126-
126+
127127
// These should NOT match
128128
const incomplete = [
129-
'x_', // No character after underscore
130-
'x^', // No character after caret
131-
'_n', // Underscore at start
132-
'^2', // Caret at start
129+
'x_', // No character after underscore
130+
'x^', // No character after caret
131+
'_n', // Underscore at start
132+
'^2', // Caret at start
133133
]
134-
135-
incomplete.forEach(text => {
134+
135+
incomplete.forEach((text) => {
136136
const matches = text.match(combined)
137137
expect(matches).toBeNull()
138138
})
139139
})
140-
140+
141141
it('should handle mixed subscripts and superscripts', () => {
142142
const combined = createCombinedPattern(patterns, config)
143-
143+
144144
// Note: x_i^2 is tricky - after matching x_i, we're left with ^2
145145
// But i^2 also matches because i is a standalone letter
146146
const mixed = 'The term x_i represents x_i squared'
147147
const matches = mixed.match(combined)
148148
expect(matches).toContain('x_i')
149149
expect(matches).toHaveLength(2) // Two x_i matches
150-
150+
151151
// For x_i^2, better to have spaces: x_i ^2
152152
const mixed2 = 'The term x_i ^2 equals x_i squared'
153153
const matches2 = mixed2.match(combined)
154154
expect(matches2).toContain('x_i')
155155
expect(matches2).toHaveLength(2) // Two x_i, ^2 won't match without variable
156156
})
157157
})
158-
158+
159159
describe('Processing Results', () => {
160160
it('should correctly process single-letter subscripts', () => {
161161
const result = processMatch('x_n')
@@ -166,7 +166,7 @@ describe('Mathematical Notation Support', () => {
166166
expect(result.parts[1].type).toBe('sub')
167167
expect(result.parts[1].content).toBe('n')
168168
})
169-
169+
170170
it('should correctly process single-letter superscripts', () => {
171171
const result = processMatch('x^n')
172172
expect(result.modified).toBe(true)
@@ -176,19 +176,19 @@ describe('Mathematical Notation Support', () => {
176176
expect(result.parts[1].type).toBe('super')
177177
expect(result.parts[1].content).toBe('n')
178178
})
179-
179+
180180
it('should correctly extract content from braced expressions', () => {
181181
const result1 = processMatch('x_{n+1}')
182182
expect(result1.modified).toBe(true)
183183
expect(result1.parts).toHaveLength(2)
184184
expect(result1.parts[0].content).toBe('x')
185185
expect(result1.parts[1].content).toBe('n+1') // Braces removed
186-
186+
187187
const result2 = processMatch('x^{2n}')
188188
expect(result2.modified).toBe(true)
189189
expect(result2.parts).toHaveLength(2)
190190
expect(result2.parts[0].content).toBe('x')
191191
expect(result2.parts[1].content).toBe('2n') // Braces removed
192192
})
193193
})
194-
})
194+
})

0 commit comments

Comments
 (0)