Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: converting from monolith to monorepo, starting package decomposition #535

Open
wants to merge 3 commits into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 3 additions & 3 deletions .commitlintrc.ts
@@ -1,9 +1,9 @@
import { UserConfig, RuleConfigSeverity } from '@commitlint/types';
import { LOCALE_IDS } from './lib/constants/locales';
import { CALENDAR_IDS } from './lib/constants/calendars';
import { LOCALE_IDS } from './rites/roman1969/src/constants/locales';
import { CALENDAR_IDS } from './rites/roman1969/src/constants/calendars';

const empty = [null];
const scopes = [...CALENDAR_IDS, ...LOCALE_IDS, 'calendar', 'l10n', 'util'];
const scopes = [...CALENDAR_IDS, ...LOCALE_IDS, 'calendar', 'l10n', 'util', 'package'];
const styleScopes = ['commitlint', 'editorconfig', 'eslint', 'prettier'];

const typesEnumScoped = {
Expand Down
146 changes: 4 additions & 142 deletions .eslintrc.js
@@ -1,146 +1,8 @@
module.exports = {
root: true,
env: {
browser: false,
es6: true,
node: true,
},
extends: ['./packages/config/.eslintrc.js'],
parserOptions: {
project: 'tsconfig.json',
sourceType: 'module',
},
extends: [
'airbnb-base',
// although this is typescript, it has to be here to have it's imported rules configured for
// typescript and not re-apply them in the typescript inherited portion
'airbnb-typescript/base',
'plugin:prettier/recommended',
],
plugins: ['unused-imports'],
rules: {
// disable conflicting prettier-adjacent rules
'max-len': 'off',
'no-mixed-spaces-and-tabs': 'off',
'keyword-spacing': 'off',
'comma-style': 'off',
'arrow-body-style': 'off',
'prefer-arrow-callback': 'off',

// imports, sort and group
'import/first': 'error',
'import/newline-after-import': 'error',
'import/no-duplicates': 'error',
'import/no-unused-modules': 'error',
'import/no-default-export': 'error',
'import/order': [
'error',
{
groups: ['builtin', 'external', 'internal', 'parent', 'sibling', 'index'],
'newlines-between': 'always',
},
],
'import/no-extraneous-dependencies': [
'error',
{
devDependencies: ['tests/**', 'scripts/**'],
},
],
'import/prefer-default-export': 'off',

// TODO: remove, especially if you wanna watch it go boom!
'import/no-cycle': 'off',

'no-console': 'error',
'object-shorthand': 'error',
'@typescript-eslint/no-unused-vars': ['error', { argsIgnorePattern: '^_', ignoreRestSiblings: true }],
'unused-imports/no-unused-imports': 'error',
'no-return-assign': ['error', 'except-parens'],

// gotta do it sometimes
'no-await-in-loop': 'off',

// prettier
'prettier/prettier': [
'error',
{},
{
usePrettierrc: true,
},
],
root: true,
tsconfigRootDir: __dirname,
project: 'tsconfig.base.json',
},
// override specific to test files
overrides: [
{
files: ['scripts/**/*.ts', 'lib/**/*.ts', 'tests/**/*.ts'],
parser: '@typescript-eslint/parser',
plugins: ['@typescript-eslint'],
rules: {
// disable overlapping non-typescript rules
'no-return-await': 'off',
'no-unused-vars': 'off',

// oddly failing only on ci...?
'import/extensions': 'off',

// overlapping typescript-only format rules
'@typescript-eslint/indent': 'off',
'@typescript-eslint/comma-dangle': 'off',

'@typescript-eslint/explicit-module-boundary-types': 'error',
'@typescript-eslint/explicit-function-return-type': 'error',
'@typescript-eslint/no-non-null-assertion': 'error',
'@typescript-eslint/no-explicit-any': 'error',
'@typescript-eslint/no-use-before-define': 'error',
'@typescript-eslint/no-shadow': ['error'],

'@typescript-eslint/return-await': ['error', 'always'],
'@typescript-eslint/array-type': ['error', { default: 'array' }],
'@typescript-eslint/class-literal-property-style': ['error', 'getters'],
'@typescript-eslint/prefer-readonly': 'error',
'@typescript-eslint/no-confusing-non-null-assertion': 'error',
'@typescript-eslint/no-extraneous-class': 'error',
'@typescript-eslint/prefer-includes': 'error',
'@typescript-eslint/prefer-optional-chain': 'error',
'@typescript-eslint/prefer-regexp-exec': 'error',
'@typescript-eslint/require-array-sort-compare': ['error', { ignoreStringArrays: true }],
},
// i know the nesting is weird, but this keeps all the tests inheriting ts base configs
overrides: [
{
files: ['scripts/**/*.ts', 'lib/types/**/*.ts', 'lib/utils/**/*.ts', 'lib/constants/**/*.ts'],
rules: {
// scripts don't export, and utils are always needed!
// turn this off to see if there's anything unused worth removing
'import/no-unused-modules': 'off',
'no-console': 'off',
},
},
{
files: ['lib/particular-calendars/*.ts'],
rules: {
'@typescript-eslint/naming-convention': [
'error',
{
selector: 'class',
format: null,
custom: {
regex: '^([A-Z][a-z]+)+(?:_([A-Z][a-z]+)+)*$',
match: true,
},
},
],
},
},
{
files: ['tests/**/*.ts', '**/*.spec.ts'],
extends: ['plugin:jest/recommended'],
plugins: ['jest'],
rules: {
// tests don't export
'import/no-unused-modules': 'off',
},
},
],
},
],
};
2 changes: 1 addition & 1 deletion .github/workflows/dev-publishing.yml
Expand Up @@ -108,4 +108,4 @@ jobs:
- name: Npm publish a new 'dev' version (romcal + all calendar bundles)
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
run: node -r ts-node/register scripts/publish.ts
run: node -r ts-node/register rites/roman1969/build/publish.ts
2 changes: 1 addition & 1 deletion .npmignore
Expand Up @@ -12,7 +12,7 @@ coverage/
# Main codebase
.github/
lib/
scripts/
build/
tests/
.editorconfig
.eslintignore
Expand Down
6 changes: 3 additions & 3 deletions .vscode/settings.json
Expand Up @@ -5,10 +5,10 @@
"editor.formatOnSave": true,
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.codeActionsOnSave": {
"source.fixAll.eslint": true, // if developer has eslint extension enabled
"source.fixAll.tslint": false // if developer has tslint extension enabled
"source.fixAll.eslint": "explicit",
"source.fixAll.tslint": "never"
},
"eslint.format.enable": false, // let prettier do it, it is faster and safer
// Jest extension settings
"jest.autoRun": {}
"jest.runMode": "on-demand"
}
2 changes: 1 addition & 1 deletion README.md
Expand Up @@ -298,7 +298,7 @@ Also, some properties like `colors`, `ranks`, `precedence` might be updated in a

You might only need the `Date` of a liturgical day, without computing all other metadata or a whole calendar.

This gives you access to all methods from the `Dates` class: [./lib/utils/dates.ts](./lib/utils/dates.ts).
This gives you access to all methods from the `Dates` class: [./rites/roman1969/src/utils/dates.ts](./rites/roman1969/src/utils/dates.ts).

The `year` parameter is optional (taking the current year by default, if not provided).

Expand Down
4 changes: 4 additions & 0 deletions global.d.ts
@@ -0,0 +1,4 @@
/* eslint-disable import/no-unused-modules */
/* eslint-disable import/no-extraneous-dependencies */

import 'jest-extended';
13 changes: 0 additions & 13 deletions jest.config.js

This file was deleted.