Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,4 @@ coverage
documentation
.rdf-test-suite-cache
earl.ttl
.eslintcache
90 changes: 90 additions & 0 deletions eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
const config = require('@rubensworks/eslint-config');

module.exports = config([
{
ignores: [
'node_modules',
'coverage',
'**/*.js',
'**/*.d.ts',
'**/*.js.map',
'**/*.yml',
'**/*.yaml',
'**/*.md',
'perf/**',
],
},
{
files: [ '**/*.ts' ],
languageOptions: {
parserOptions: {
tsconfigRootDir: __dirname,
project: [ './tsconfig.eslint.json' ],
},
},
},
{
// Project-specific overrides for TypeScript files
files: [ '**/*.ts' ],
rules: {
// Project uses strictNullChecks: false, so this rule cannot be applied
'ts/prefer-nullish-coalescing': 'off',
// This is a Node.js library that legitimately imports Node.js built-in modules
'import/no-nodejs-modules': 'off',
// Allow UPPER_CASE for class properties (public API constants) and enum members
'ts/naming-convention': [
'error',
{
selector: 'default',
format: [ 'camelCase' ],
leadingUnderscore: 'forbid',
trailingUnderscore: 'forbid',
},
{
selector: 'import',
format: null,
},
{
selector: 'variable',
format: [ 'camelCase', 'UPPER_CASE' ],
leadingUnderscore: 'forbid',
trailingUnderscore: 'forbid',
},
{
selector: 'classProperty',
format: [ 'camelCase', 'UPPER_CASE' ],
leadingUnderscore: 'forbid',
trailingUnderscore: 'forbid',
},
{
selector: 'enumMember',
format: [ 'camelCase', 'UPPER_CASE' ],
},
{
selector: 'typeLike',
format: [ 'PascalCase' ],
},
{
selector: [ 'typeParameter' ],
format: [ 'PascalCase' ],
prefix: [ 'T' ],
},
{
selector: 'interface',
format: [ 'PascalCase' ],
custom: {
regex: '^I[A-Z]',
match: true,
},
},
{
// Allow leading underscore for Node.js Transform stream override methods
selector: 'method',
format: [ 'camelCase' ],
leadingUnderscore: 'allow',
trailingUnderscore: 'forbid',
},
],
},
},
]);
10 changes: 4 additions & 6 deletions lib/ParseError.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
import {SaxesParser} from "@rubensworks/saxes";
import {RdfXmlParser} from "./RdfXmlParser";
import type { SaxesParser } from '@rubensworks/saxes';
import type { RdfXmlParser } from './RdfXmlParser';

/**
* An error that includes line and column in the error message.
*/
export class ParseError extends Error {

constructor(parser: RdfXmlParser, message: string) {
const saxParser: SaxesParser = (<any>parser).saxParser;
public constructor(parser: RdfXmlParser, message: string) {
const saxParser: SaxesParser = (<{ saxParser: SaxesParser }><unknown>parser).saxParser;
super(parser.trackPosition ? `Line ${saxParser.line} column ${saxParser.column + 1}: ${message}` : message);
}

}
Loading