refactor: Apply naming-convention rules

This commit is contained in:
Joachim Van Herwegen
2020-09-17 11:01:15 +02:00
parent 9657fbafb1
commit e349e04119
3 changed files with 30 additions and 4 deletions

View File

@@ -25,7 +25,6 @@ module.exports = {
},
rules: {
'@typescript-eslint/lines-between-class-members': [ 'error', { exceptAfterSingleLine: true }],
'@typescript-eslint/naming-convention': 'off',
'@typescript-eslint/no-empty-interface': 'off',
'@typescript-eslint/no-invalid-void-type': 'off', // breaks with default void in Asynchandler 2nd generic
'@typescript-eslint/no-unnecessary-condition': 'off', // problems with optional parameters
@@ -48,6 +47,32 @@ module.exports = {
'unicorn/no-fn-reference-in-iterator': 'off', // this prevents some functional programming paradigms
'unicorn/no-object-as-default-parameter': 'off',
// Naming conventions
'@typescript-eslint/naming-convention': [
'error',
{
selector: 'default',
format: ['camelCase'],
leadingUnderscore: 'forbid',
trailingUnderscore: 'forbid',
},
{
selector: 'variable',
format: ['camelCase', 'UPPER_CASE'],
leadingUnderscore: 'forbid',
trailingUnderscore: 'forbid',
},
{
selector: 'typeLike',
format: ['PascalCase'],
},
{
selector: [ 'typeParameter' ],
format: [ 'PascalCase' ],
prefix: [ 'T' ]
}
],
// Import
'sort-imports': 'off', // Disabled in favor of eslint-plugin-import
'import/order': ['error', {

View File

@@ -13,13 +13,13 @@ import { pipeStreamsAndErrors } from './Util';
export class MetadataController {
/**
* Helper function to generate quads for a Container or Resource.
* @param URI - The URI for which the quads should be generated.
* @param uri - The URI for which the quads should be generated.
* @param stats - The Stats of the subject.
*
* @returns The generated quads.
*/
public generateResourceQuads(URI: string, stats: Stats): Quad[] {
const metadata = new RepresentationMetadata(URI);
public generateResourceQuads(uri: string, stats: Stats): Quad[] {
const metadata = new RepresentationMetadata(uri);
if (stats.isDirectory()) {
metadata.add(RDF.type, getNamedNode(LDP.Container));
metadata.add(RDF.type, getNamedNode(LDP.BasicContainer));

View File

@@ -1,3 +1,4 @@
/* eslint-disable @typescript-eslint/naming-convention */
const createSuffixFn = (prefix: string): ((suf: string) => string) => (suffix: string): string => `${prefix}${suffix}`;
const ACL_PREFIX = createSuffixFn('http://www.w3.org/ns/auth/acl#');