Skip to content

Commit

Permalink
Fix/contants to enums (#15)
Browse files Browse the repository at this point in the history
* refactor: Rename constants.js to enums.js and update related imports

* chore: Update eslint configuration and devDependencies
  • Loading branch information
jwaspin authored May 1, 2024
1 parent b9c12d0 commit 7b07847
Show file tree
Hide file tree
Showing 5 changed files with 569 additions and 57 deletions.
37 changes: 37 additions & 0 deletions eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import globals from 'globals';
import pluginJs from '@eslint/js';
import prettierPlugin from 'eslint-plugin-prettier';
import jsonPlugin from 'eslint-plugin-json';

export default [
{
languageOptions: {
globals: globals.browser,
ecmaVersion: 2023,
sourceType: 'module'
},
parserOptions: {
requireConfigFile: false,
babelOptions: {
presets: ['@babel/preset-env']
}
}
},
pluginJs.configs.recommended,
prettierPlugin.configs.recommended,
jsonPlugin.configs.recommended,
{
settings: {
jest: {
version: 29
}
},
plugins: {
prettier: prettierPlugin,
json: jsonPlugin
},
rules: {
'prettier/prettier': ['error'],
}
}
];
32 changes: 19 additions & 13 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,18 +31,6 @@
"publish-beta": "yarn && yarn build && yarn publish --tag beta --access public",
"test": "yarn build && jest"
},
"devDependencies": {
"@babel/cli": "^7.24.1",
"@babel/core": "^7.24.4",
"@babel/preset-env": "^7.24.4",
"ajv": "^8.12.0",
"ajv-formats": "^2.1.1",
"babel-jest": "^29.7.0",
"fs-extra": "^11.2.0",
"jest": "^29.7.0",
"prettier": "^3.2.5",
"rimraf": "^5.0.5"
},
"exports": {
".": {
"import": "./dist/esm/index.js",
Expand All @@ -57,5 +45,23 @@
"dist/",
"LICENSE",
"README.md"
]
],
"devDependencies": {
"@babel/cli": "^7.24.1",
"@babel/core": "^7.24.4",
"@babel/preset-env": "^7.24.4",
"@eslint/js": "^9.1.1",
"ajv": "^8.12.0",
"ajv-formats": "^2.1.1",
"babel-jest": "^29.7.0",
"eslint": "^9.1.1",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-json": "^3.1.0",
"eslint-plugin-prettier": "^5.1.3",
"fs-extra": "^11.2.0",
"globals": "^15.1.0",
"jest": "^29.7.0",
"prettier": "^3.2.5",
"rimraf": "^5.0.5"
}
}
26 changes: 18 additions & 8 deletions src/constants.js → src/enums.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
const SchemasEnum = Object.freeze({
CATEGORY: 'category',
ENTITY: 'entity',
LUCASCHEMA: 'lucaSchema',
RECURRING_TRANSACTION: 'recurringTransaction',
RECURRING_TRANSACTION_EVENT: 'recurringTransactionEvent',
SCHEMA: 'schema',
TRANSACTION: 'transaction'
});

const TransactionStateEnum = Object.freeze({
PLANNED: 'PLANNED',
SCHEDULED: 'SCHEDULED',
Expand Down Expand Up @@ -35,33 +45,33 @@ const EntityStatusEnum = Object.freeze({
CLOSED: 'CLOSED'
});

const RepeatedTransactionFrequencyEnum = Object.freeze({
const RecurringTransactionFrequencyEnum = Object.freeze({
DAY: 'DAY',
WEEK: 'WEEK',
MONTH: 'MONTH',
YEAR: 'YEAR'
});

const RepeatedTransactionStateEnum = Object.freeze({
const RecurringTransactionStateEnum = Object.freeze({
ACTIVE: 'ACTIVE',
PAUSED: 'PAUSED',
COMPLETED: 'COMPLETED',
CANCELLED: 'CANCELLED'
});

const RepeatedTransactionOccurrenceStatusEnum = Object.freeze({
const RecurringTransactionEventStatusEnum = Object.freeze({
MODIFIED: 'MODIFIED',
DELETED: 'DELETED'
});

const constants = {
const enums = {
TransactionStateEnum,
CategoryTypeEnum,
EntityTypeEnum,
EntityStatusEnum,
RepeatedTransactionFrequencyEnum,
RepeatedTransactionStateEnum,
RepeatedTransactionOccurrenceStatusEnum
RecurringTransactionFrequencyEnum,
RecurringTransactionStateEnum,
RecurringTransactionEventStatusEnum
};

export default constants;
export default enums;
4 changes: 2 additions & 2 deletions src/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import constants from './constants';
import enums from './enums';
import lucaValidator from './lucaValidator';
import schemas from './schemas';

export { constants, lucaValidator, schemas };
export { enums, lucaValidator, schemas };
Loading

0 comments on commit 7b07847

Please sign in to comment.