website refactor
This commit is contained in:
@@ -1,37 +0,0 @@
|
||||
module.exports = {
|
||||
meta: {
|
||||
type: 'problem',
|
||||
docs: {
|
||||
description: 'Enforce adapter naming conventions',
|
||||
category: 'Architecture',
|
||||
recommended: true,
|
||||
},
|
||||
fixable: null,
|
||||
schema: [],
|
||||
messages: {
|
||||
invalidNaming: 'Adapter classes should end with "Adapter", "Repository", "Service", "Factory" or "Entity". Found: {{name}}',
|
||||
},
|
||||
},
|
||||
|
||||
create(context) {
|
||||
return {
|
||||
ClassDeclaration(node) {
|
||||
const filename = context.getFilename();
|
||||
if (!filename.includes('adapters/')) return;
|
||||
|
||||
const name = node.id.name;
|
||||
const isValidName = /(.+)(Adapter|Factory|Repository|Service|Entity|Mapper|Schema|Guard|Module|Controller)$/.test(name);
|
||||
|
||||
if (!isValidName) {
|
||||
context.report({
|
||||
node,
|
||||
messageId: 'invalidNaming',
|
||||
data: {
|
||||
name,
|
||||
},
|
||||
});
|
||||
}
|
||||
},
|
||||
};
|
||||
},
|
||||
};
|
||||
@@ -1,17 +1,14 @@
|
||||
const noIndexFiles = require('./no-index-files');
|
||||
const adapterNaming = require('./adapter-naming');
|
||||
|
||||
module.exports = {
|
||||
rules: {
|
||||
'no-index-files': noIndexFiles,
|
||||
'adapter-naming': adapterNaming,
|
||||
},
|
||||
configs: {
|
||||
recommended: {
|
||||
plugins: ['gridpilot-adapters-rules'],
|
||||
rules: {
|
||||
'gridpilot-adapters-rules/no-index-files': 'error',
|
||||
'gridpilot-adapters-rules/adapter-naming': 'error',
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user