Skip to content

Commit

Permalink
Bump dev-deps, fix resulting issues
Browse files Browse the repository at this point in the history
  • Loading branch information
kristiandupont committed Jun 9, 2023
1 parent 4ccb745 commit d1462dd
Show file tree
Hide file tree
Showing 6 changed files with 1,123 additions and 237 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
"ramda": "^0.28.0"
},
"devDependencies": {
"@kristiandupont/dev-deps": "^1.5.0",
"@kristiandupont/dev-deps": "^2.2.0",
"@types/ramda": "0.28.23",
"np": "7.6.4",
"testcontainers": "9.3.0"
Expand Down
1 change: 0 additions & 1 deletion src/cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,5 +72,4 @@ async function main() {
}
}

// eslint-disable-next-line unicorn/prefer-top-level-await
main();
11 changes: 7 additions & 4 deletions src/rules/nameInflection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,18 @@ import Rule from '../Rule';

const singulars = R.keys(irregularPlurals);
const plurals = R.values(irregularPlurals);
const trimSeparators = (s: string) => s.replace(/^(-|_)+|(-|_)+$/g, '');
const trimSeparators = (s: string) => s.replaceAll(/^(-|_)+|(-|_)+$/g, '');

const detectInflection = (word: string) => {
const words = word
.split(/(?=[A-Z_-])/)
.map(trimSeparators)
.filter(Boolean);

const lastWord = words[words.length - 1].toLowerCase();
const lastWord = words.at(-1)?.toLowerCase();
if (!lastWord) {
return 'unknown';
}

if (
lastWord in irregularPlurals &&
Expand All @@ -33,10 +36,10 @@ const detectInflection = (word: string) => {
}

// Regular plural words end with s
const endsWithS = lastWord[lastWord.length - 1] === 's';
const endsWithS = lastWord.at(-1) === 's';

// ..but some singular ones do as well. Though they typically have two s's (like kiss, address and fortress)
const doubleS = lastWord.length > 1 && lastWord[lastWord.length - 2] === 's';
const doubleS = lastWord.length > 1 && lastWord.at(-2) === 's';

const isPlural = endsWithS && !doubleS;

Expand Down
2 changes: 1 addition & 1 deletion src/rules/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ export const preferIdentity: Rule = {
defaultValue.includes('nextval')
) {
let sequenceName = defaultValue.match("'(.*)'")[1];
sequenceName = sequenceName.replace(/"/g, '');
sequenceName = sequenceName.replaceAll('"', '');

report({
rule: this.name,
Expand Down
2 changes: 1 addition & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"compilerOptions": {
/* Basic Options */
// "incremental": true, /* Enable incremental compilation */
"target": "es5" /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019' or 'ESNEXT'. */,
"target": "ESNext" /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019' or 'ESNEXT'. */,
"module": "commonjs" /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. */,
// "lib": [], /* Specify library files to be included in the compilation. */
"allowJs": true /* Allow javascript files to be compiled. */,
Expand Down
Loading

0 comments on commit d1462dd

Please sign in to comment.