Skip to content

Commit

Permalink
chore: bump deps
Browse files Browse the repository at this point in the history
- bump deps
- update eslint and TS configuration
- improve test cases
- stop testing in Node 13
- start testing in Node 14
- update example
  • Loading branch information
dbstratta committed Jun 6, 2020
1 parent ec93a5c commit aefb8ba
Show file tree
Hide file tree
Showing 12 changed files with 2,582 additions and 2,246 deletions.
49 changes: 17 additions & 32 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ module.exports = {
],

env: {
es6: true,
es2020: true,
jest: true,
node: true,
},
Expand All @@ -36,21 +36,30 @@ module.exports = {
'plugin:jest/recommended',
'airbnb-base',
'plugin:@typescript-eslint/recommended',
'plugin:@typescript-eslint/recommended-requiring-type-checking',
'plugin:eslint-comments/recommended',
'prettier',
],

rules: {
'no-undef': 'off',
'no-unused-vars': 'off',
'no-restricted-globals': 'off',
'no-shadow': 'off',
'prefer-destructuring': 'off',
'no-multi-str': 'off',
'no-use-before-define': 'off',

'unicorn/filename-case': 'off',
'unicorn/prevent-abbreviations': 'off',
'unicorn/no-reduce': 'off',

'import/no-named-as-default': 'off',
'import/no-extraneous-dependencies': 'off',
'import/prefer-default-export': 'off',
'import/order': ['error', { 'newlines-between': 'always' }],
'import/extensions': 'off',
'import/export': 'off',

'prettier/prettier': 'error',

Expand All @@ -71,6 +80,13 @@ module.exports = {
'@typescript-eslint/indent': 'off',
'@typescript-eslint/no-var-requires': 'off',
'@typescript-eslint/no-use-before-define': 'off',
'@typescript-eslint/naming-convention': 'error',
'@typescript-eslint/no-this-alias': 'error',
'@typescript-eslint/restrict-plus-operands': 'error',
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/explicit-function-return-type': 'off',
'@typescript-eslint/no-non-null-assertion': 'off',
'@typescript-eslint/prefer-interface': 'off',
},

settings: {
Expand All @@ -80,35 +96,4 @@ module.exports = {
},
},
},

overrides: [
{
files: ['**/*.ts', '**/*.tsx'],

rules: {
'no-undef': 'off',
'no-unused-vars': 'off',
'no-restricted-globals': 'off',
'no-shadow': 'off',
'prefer-destructuring': 'off',
'no-multi-str': 'off',

'react/prop-types': 'off',
'react/sort-comp': 'off',
'react/destructuring-assignment': 'off',

'import/export': 'off',

'@typescript-eslint/generic-type-naming': [
'error',
'^T[A-Z][a-zA-Z]+$',
],
'@typescript-eslint/no-this-alias': 'error',
// '@typescript-eslint/restrict-plus-operands': 'error',
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/indent': 'off',
'@typescript-eslint/explicit-function-return-type': 'off',
},
},
],
};
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,7 @@ import { makeEnv, parsers } from '@strattadb/environment';

const env = makeEnv({
someValue: {
parser: value => {
parser: (value) => {
if (value === 'forbiddenValue') {
throw new Error('value is forbidden');
}
Expand Down Expand Up @@ -405,7 +405,7 @@ Yes! You can have as many env objects as you want!
## Node.js support

Node.js version 10 or higher. Every version of this library
is tested in Node.js 10, 12 and 13.
is tested in Node.js 10, 12 and 14.

## Contributing

Expand Down
8 changes: 3 additions & 5 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ jobs:
node_version: 10.x
node_12_x:
node_version: 12.x
node_13_x:
node_version: 13.x
node_14_x:
node_version: 14.x

steps:
- template: azure-pipelines/install.yml
Expand Down Expand Up @@ -45,7 +45,6 @@ jobs:
CODECOV_TOKEN: $(CODECOV_TOKEN)
displayName: 'Upload coverage report'


- job: publish
displayName: 'Publish'
condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/master'))
Expand All @@ -71,5 +70,4 @@ jobs:

variables:
CI: true
defaultNodeVersion: '13.8.0'

defaultNodeVersion: '14.4.0'
2 changes: 1 addition & 1 deletion examples/server/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@
"license": "MIT",
"private": true,
"dependencies": {
"@strattadb/environment": "^7.0.0"
"@strattadb/environment": "^8.0.0"
}
}
18 changes: 9 additions & 9 deletions examples/server/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@
# yarn lockfile v1


"@strattadb/environment@^7.0.0":
version "7.0.0"
resolved "https://registry.yarnpkg.com/@strattadb/environment/-/environment-7.0.0.tgz#d017918e23620cd68d30c4d75298a265834b5f7e"
integrity sha512-nextyUFe5rL2zBQlhrD4s6xLX+H0e6rPlicvJ6AGqRDXcpfCN+TSOLk04r4IuurToerPa1lV2v1G87Bslr2atQ==
"@strattadb/environment@^8.0.0":
version "8.0.0"
resolved "https://registry.yarnpkg.com/@strattadb/environment/-/environment-8.0.0.tgz#702dd6d50fe0a3166f79ceb9fbeb411d10178d44"
integrity sha512-I7Z4orwMLMT9QygOv4uTDrRit3oac2XM/eOCCwZtg7hHem+X8c4/UUzUiyhKUVMMw3IZxbDlw0lfBoY2lHi3Gw==
dependencies:
debug "^4.1.1"
validator "^10.11.0"
validator "^12.2.0"

debug@^4.1.1:
version "4.1.1"
Expand All @@ -22,7 +22,7 @@ ms@^2.1.1:
resolved "https://registry.yarnpkg.com/ms/-/ms-2.1.2.tgz#d09d1f357b443f493382a8eb3ccd183872ae6009"
integrity sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==

validator@^10.11.0:
version "10.11.0"
resolved "https://registry.yarnpkg.com/validator/-/validator-10.11.0.tgz#003108ea6e9a9874d31ccc9e5006856ccd76b228"
integrity sha512-X/p3UZerAIsbBfN/IwahhYaBbY68EN/UQBWHtsbXGT5bfrH/p4NQzUCG1kF/rtKaNpnJ7jAu6NGTdSNtyNIXMw==
validator@^12.2.0:
version "12.2.0"
resolved "https://registry.yarnpkg.com/validator/-/validator-12.2.0.tgz#660d47e96267033fd070096c3b1a6f2db4380a0a"
integrity sha512-jJfE/DW6tIK1Ek8nCfNFqt8Wb3nzMoAbocBF6/Icgg1ZFSBpObdnwVY2jQj6qUqzhx5jc71fpvBWyLGO7Xl+nQ==
62 changes: 31 additions & 31 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,47 +31,47 @@
"private": false,
"dependencies": {
"debug": "^4.1.1",
"validator": "^12.2.0"
"validator": "^13.0.0"
},
"devDependencies": {
"@babel/cli": "7.8.4",
"@babel/core": "7.8.4",
"@babel/preset-env": "7.8.4",
"@babel/preset-typescript": "7.8.3",
"@babel/cli": "7.10.1",
"@babel/core": "7.10.2",
"@babel/preset-env": "7.10.2",
"@babel/preset-typescript": "7.10.1",
"@commitlint/cli": "8.3.5",
"@commitlint/config-conventional": "8.3.4",
"@commitlint/prompt-cli": "8.3.5",
"@semantic-release/changelog": "5.0.0",
"@semantic-release/changelog": "5.0.1",
"@semantic-release/git": "9.0.0",
"@types/debug": "4.1.5",
"@types/jest": "25.1.2",
"@types/node": "13.7.0",
"@types/validator": "12.0.1",
"@typescript-eslint/eslint-plugin": "2.19.0",
"@typescript-eslint/parser": "2.19.0",
"babel-jest": "25.1.0",
"babel-plugin-dynamic-import-node": "2.3.0",
"codecov": "3.6.5",
"cross-env": "7.0.0",
"danger": "9.2.10",
"eslint": "6.8.0",
"eslint-config-airbnb-base": "14.0.0",
"eslint-config-prettier": "6.10.0",
"eslint-plugin-eslint-comments": "3.1.2",
"eslint-plugin-import": "2.20.1",
"eslint-plugin-jest": "23.7.0",
"eslint-plugin-node": "11.0.0",
"eslint-plugin-prettier": "3.1.2",
"@types/jest": "25.2.3",
"@types/node": "14.0.11",
"@types/validator": "13.0.0",
"@typescript-eslint/eslint-plugin": "3.1.0",
"@typescript-eslint/parser": "3.1.0",
"babel-jest": "26.0.1",
"babel-plugin-dynamic-import-node": "2.3.3",
"codecov": "3.7.0",
"cross-env": "7.0.2",
"danger": "10.2.0",
"eslint": "7.2.0",
"eslint-config-airbnb-base": "14.1.0",
"eslint-config-prettier": "6.11.0",
"eslint-plugin-eslint-comments": "3.2.0",
"eslint-plugin-import": "2.20.2",
"eslint-plugin-jest": "23.13.2",
"eslint-plugin-node": "11.1.0",
"eslint-plugin-prettier": "3.1.3",
"eslint-plugin-promise": "4.2.1",
"eslint-plugin-security": "1.4.0",
"eslint-plugin-unicorn": "16.0.0",
"husky": "4.2.1",
"jest": "25.1.0",
"lint-staged": "10.0.7",
"prettier": "1.19.1",
"eslint-plugin-unicorn": "20.1.0",
"husky": "4.2.5",
"jest": "26.0.1",
"lint-staged": "10.2.9",
"prettier": "2.0.5",
"rimraf": "3.0.2",
"semantic-release": "17.0.2",
"typescript": "3.7.5"
"semantic-release": "17.0.8",
"typescript": "3.9.5"
},
"keywords": [
"environment",
Expand Down
7 changes: 0 additions & 7 deletions prettier.config.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,4 @@
module.exports = {
singleQuote: true,
trailingComma: 'all',
semi: true,
overrides: [
{
files: '*.json',
options: { trailingComma: 'none' },
},
],
};
14 changes: 9 additions & 5 deletions src/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,23 @@ describe('environment', () => {
expect(typeof environment.makeEnv).toBe('function');
});

test('exports an object `parsers` contain parsers', () => {
test('exports an object `parsers` that contains parsers', () => {
expect(typeof environment.parsers).toBe('object');

Object.values(environment.parsers).forEach(parser => {
Object.values(environment.parsers).forEach((parser) => {
expect(typeof parser).toBe('function');
});
});

test('the `parsers` object contains all the parsers', () => {
Object.entries(parsers).forEach(([name, parser]) => {
if (typeof parser === 'function') {
expect(environment.parsers).toEqual(
expect.objectContaining({ [name]: parser }),
);
return;
}

expect(environment.parsers).toEqual(
expect.objectContaining({ [name]: parser }),
);
});
});
});
4 changes: 2 additions & 2 deletions src/parsers.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ describe('parsers.boolean', () => {
const serializedTruthyValues = ['true', '1', 'yes', 'on'];
const expectedValue = true;

serializedTruthyValues.forEach(serializedTruthyValue => {
serializedTruthyValues.forEach((serializedTruthyValue) => {
expect(parsers.boolean(serializedTruthyValue)).toEqual(expectedValue);
});
});
Expand All @@ -23,7 +23,7 @@ describe('parsers.boolean', () => {
const serializedFalsyValues = ['false', '0', 'no', 'off'];
const expectedValue = false;

serializedFalsyValues.forEach(serializedFalsyValue => {
serializedFalsyValues.forEach((serializedFalsyValue) => {
expect(parsers.boolean(serializedFalsyValue)).toEqual(expectedValue);
});
});
Expand Down
Loading

0 comments on commit aefb8ba

Please sign in to comment.