Skip to content

Commit e15ee30

Browse files
Copilotrubensworks
andauthored
chore: install eslint with rubensworks config, add eslint.config.js and tsconfig.eslint.json
Agent-Logs-Url: https://github.com/rdfjs/rdfxml-streaming-parser.js/sessions/46b14265-34c1-4bd0-b41d-2a2e1a911a1d Co-authored-by: rubensworks <440384+rubensworks@users.noreply.github.com>
1 parent 84c395b commit e15ee30

File tree

14 files changed

+3645
-1061
lines changed

14 files changed

+3645
-1061
lines changed

.eslintcache

Lines changed: 1 addition & 0 deletions
Large diffs are not rendered by default.

eslint.config.js

Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
const config = require('@rubensworks/eslint-config');
2+
3+
module.exports = config([
4+
{
5+
ignores: [
6+
'node_modules',
7+
'coverage',
8+
'**/*.js',
9+
'**/*.d.ts',
10+
'**/*.js.map',
11+
'**/*.yml',
12+
'**/*.yaml',
13+
'**/*.md',
14+
'perf/**',
15+
],
16+
},
17+
{
18+
files: [ '**/*.ts' ],
19+
languageOptions: {
20+
parserOptions: {
21+
tsconfigRootDir: __dirname,
22+
project: [ './tsconfig.eslint.json' ],
23+
},
24+
},
25+
},
26+
{
27+
// Project-specific overrides for TypeScript files
28+
files: [ '**/*.ts' ],
29+
rules: {
30+
// Project uses strictNullChecks: false, so this rule cannot be applied
31+
'ts/prefer-nullish-coalescing': 'off',
32+
// This is a Node.js library that legitimately imports Node.js built-in modules
33+
'import/no-nodejs-modules': 'off',
34+
// Allow UPPER_CASE for class properties (public API constants) and enum members
35+
'ts/naming-convention': [
36+
'error',
37+
{
38+
selector: 'default',
39+
format: [ 'camelCase' ],
40+
leadingUnderscore: 'forbid',
41+
trailingUnderscore: 'forbid',
42+
},
43+
{
44+
selector: 'import',
45+
format: null,
46+
},
47+
{
48+
selector: 'variable',
49+
format: [ 'camelCase', 'UPPER_CASE' ],
50+
leadingUnderscore: 'forbid',
51+
trailingUnderscore: 'forbid',
52+
},
53+
{
54+
selector: 'classProperty',
55+
format: [ 'camelCase', 'UPPER_CASE' ],
56+
leadingUnderscore: 'forbid',
57+
trailingUnderscore: 'forbid',
58+
},
59+
{
60+
selector: 'enumMember',
61+
format: [ 'camelCase', 'UPPER_CASE' ],
62+
},
63+
{
64+
selector: 'typeLike',
65+
format: [ 'PascalCase' ],
66+
},
67+
{
68+
selector: [ 'typeParameter' ],
69+
format: [ 'PascalCase' ],
70+
prefix: [ 'T' ],
71+
},
72+
{
73+
selector: 'interface',
74+
format: [ 'PascalCase' ],
75+
custom: {
76+
regex: '^I[A-Z]',
77+
match: true,
78+
},
79+
},
80+
{
81+
// Allow leading underscore for Node.js Transform stream override methods
82+
selector: 'method',
83+
format: [ 'camelCase' ],
84+
leadingUnderscore: 'allow',
85+
trailingUnderscore: 'forbid',
86+
},
87+
],
88+
},
89+
},
90+
]);

lib/ParseError.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,12 @@
1-
import {SaxesParser} from "@rubensworks/saxes";
2-
import {RdfXmlParser} from "./RdfXmlParser";
1+
import type { SaxesParser } from '@rubensworks/saxes';
2+
import type { RdfXmlParser } from './RdfXmlParser';
33

44
/**
55
* An error that includes line and column in the error message.
66
*/
77
export class ParseError extends Error {
8-
98
constructor(parser: RdfXmlParser, message: string) {
109
const saxParser: SaxesParser = (<any>parser).saxParser;
1110
super(parser.trackPosition ? `Line ${saxParser.line} column ${saxParser.column + 1}: ${message}` : message);
1211
}
13-
1412
}

0 commit comments

Comments
 (0)