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
2 changes: 1 addition & 1 deletion yarn-project/accounts/.eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -1 +1 @@
module.exports = require('@aztec/foundation/eslint');
module.exports = require('@aztec/foundation/eslint.docs');
2 changes: 1 addition & 1 deletion yarn-project/aztec.js/.eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -1 +1 @@
module.exports = require('@aztec/foundation/eslint');
module.exports = require('@aztec/foundation/eslint.docs');
59 changes: 1 addition & 58 deletions yarn-project/foundation/.eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -1,41 +1,3 @@
// See https://typescript-eslint.io/play/#ts=5.1.6&showAST=es&fileType=.ts
const contexts = [
// All methods in an interface
'TSInterfaceDeclaration TSMethodSignature',
// All public methods in a class that does not implement an interface
'ClassDeclaration[implements.length=0] MethodDefinition[accessibility=public]',
// TODO: All methods public by default in a class that does not implement an interface
// 'ClassDeclaration[implements.length=0] MethodDefinition[accessibility=undefined][key.type=Identifier]',
// TODO: All export const from the top level of a file
// 'ExportNamedDeclaration[declaration.type=VariableDeclaration]',
// Legacy contexts (needs review)
'TSParameterProperty[accessibility=public]',
'TSPropertySignature',
'PropertySignature',
'TSInterfaceDeclaration',
'InterfaceDeclaration',
'TSPropertyDefinition[accessibility=public]',
'PropertyDefinition[accessibility=public]',
'TSTypeAliasDeclaration',
'TypeAliasDeclaration',
'TSTypeDeclaration',
'TypeDeclaration',
'TSEnumDeclaration',
'EnumDeclaration',
'TSClassDeclaration',
'ClassDeclaration',
'TSClassExpression',
'ClassExpression',
'TSFunctionExpression',
'FunctionExpression',
'TSInterfaceExpression',
'InterfaceExpression',
'TSEnumExpression',
'EnumExpression',
];

const JSDOC_RULES_LEVEL = 'error';

module.exports = {
extends: [
'eslint:recommended',
Expand Down Expand Up @@ -112,27 +74,8 @@ module.exports = {
],
'import/no-extraneous-dependencies': 'error',
'import/no-cycle': 'warn',
'tsdoc/syntax': JSDOC_RULES_LEVEL,
'jsdoc/require-jsdoc': [
JSDOC_RULES_LEVEL,
{
contexts,
checkConstructors: false,
checkGetters: true,
checkSetters: true,
},
],
'jsdoc/require-description': [JSDOC_RULES_LEVEL, { contexts }],
'jsdoc/require-hyphen-before-param-description': [JSDOC_RULES_LEVEL],
'jsdoc/require-param': [JSDOC_RULES_LEVEL, { contexts, checkDestructured: false }],
'jsdoc/require-param-description': [JSDOC_RULES_LEVEL, { contexts }],
'jsdoc/require-param-name': [JSDOC_RULES_LEVEL, { contexts }],
'jsdoc/require-property': [JSDOC_RULES_LEVEL, { contexts }],
'jsdoc/require-property-description': [JSDOC_RULES_LEVEL, { contexts }],
'jsdoc/require-property-name': [JSDOC_RULES_LEVEL, { contexts }],
'jsdoc/require-returns': 'off',
// this unfortunately doesn't block `fit` and `fdescribe`
'no-only-tests/no-only-tests': ['error'],
},
ignorePatterns: ['node_modules', 'dest*', 'dist', '*.js', '.eslintrc.cjs'],
ignorePatterns: ['node_modules', 'dest*', 'dist', '*.js', '.eslintrc.cjs', '.eslintrc.*.cjs'],
};
69 changes: 69 additions & 0 deletions yarn-project/foundation/.eslintrc.docs.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
// See https://typescript-eslint.io/play/#ts=5.1.6&showAST=es&fileType=.ts
const contexts = [
// All methods in an interface
'TSInterfaceDeclaration TSMethodSignature',
// All public methods in a class that does not implement an interface
'ClassDeclaration[implements.length=0] MethodDefinition[accessibility=public]',
// TODO: All methods public by default in a class that does not implement an interface
// 'ClassDeclaration[implements.length=0] MethodDefinition[accessibility=undefined][key.type=Identifier]',
// TODO: All export const from the top level of a file
// 'ExportNamedDeclaration[declaration.type=VariableDeclaration]',
// Legacy contexts below (needs review)
'TSParameterProperty[accessibility=public]',
'TSPropertySignature',
'PropertySignature',
'TSInterfaceDeclaration',
'InterfaceDeclaration',
'TSPropertyDefinition[accessibility=public]',
'PropertyDefinition[accessibility=public]',
'TSTypeAliasDeclaration',
'TypeAliasDeclaration',
'TSTypeDeclaration',
'TypeDeclaration',
'TSEnumDeclaration',
'EnumDeclaration',
'TSClassDeclaration',
'ClassDeclaration',
'TSClassExpression',
'ClassExpression',
'TSFunctionExpression',
'FunctionExpression',
'TSInterfaceExpression',
'InterfaceExpression',
'TSEnumExpression',
'EnumExpression',
];

const base = require('./.eslintrc.cjs');
const JSDOC_RULES_LEVEL = 'error';

module.exports = {
...base,
plugins: [...base.plugins, 'jsdoc'],
overrides: [
...base.overrides,
{ files: '*.test.ts', rules: { 'jsdoc/require-jsdoc': 'off' } },
],
rules: {
...base.rules,
'tsdoc/syntax': JSDOC_RULES_LEVEL,
'jsdoc/require-jsdoc': [
JSDOC_RULES_LEVEL,
{
contexts,
checkConstructors: false,
checkGetters: true,
checkSetters: true,
},
],
'jsdoc/require-description': [JSDOC_RULES_LEVEL, { contexts }],
'jsdoc/require-hyphen-before-param-description': [JSDOC_RULES_LEVEL],
'jsdoc/require-param': [JSDOC_RULES_LEVEL, { contexts, checkDestructured: false }],
'jsdoc/require-param-description': [JSDOC_RULES_LEVEL, { contexts }],
'jsdoc/require-param-name': [JSDOC_RULES_LEVEL, { contexts }],
'jsdoc/require-property': [JSDOC_RULES_LEVEL, { contexts }],
'jsdoc/require-property-description': [JSDOC_RULES_LEVEL, { contexts }],
'jsdoc/require-property-name': [JSDOC_RULES_LEVEL, { contexts }],
'jsdoc/require-returns': 'off',
}
};
1 change: 1 addition & 0 deletions yarn-project/foundation/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
"types": "./dest/index.d.ts",
"exports": {
"./eslint": "./.eslintrc.cjs",
"./eslint.docs": "./.eslintrc.docs.cjs",
"./prettier": "./.prettierrc.json",
"./abi": "./dest/abi/index.js",
"./async-map": "./dest/async-map/index.js",
Expand Down