Skip to content

Commit

Permalink
chore: set up eslint for jest
Browse files Browse the repository at this point in the history
  • Loading branch information
tsvetomir committed Jul 6, 2022
1 parent bf69f39 commit fd04537
Show file tree
Hide file tree
Showing 3 changed files with 85 additions and 23 deletions.
79 changes: 63 additions & 16 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,21 +1,68 @@
module.exports = {
"env": {
"browser": true,
"es2021": true,
},
"extends": [
"eslint:recommended",
"plugin:@typescript-eslint/recommended"
root: true,
ignorePatterns: [
// Ignore build artifacts
'/node_modules',
'/dist',

// Ignore playground
'/examples'
],
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaVersion": "latest",
"sourceType": "module"
parserOptions: {
ecmaVersion: 2020,
sourceType: 'module'
},
"plugins": [
"@typescript-eslint"
plugins: [
'import',
'jest'
],
"rules": {
"@typescript-eslint/no-explicit-any": 0
rules: {
'import/no-deprecated': [
'warn'
],
'brace-style': [
'warn',
'1tbs',
{
'allowSingleLine': true
}
],
'capitalized-comments': [
'off',
'never'
],
'comma-dangle': 'error',
'default-case': 'error',
'dot-notation': 'off',
'id-denylist': [
'error',
'String',
'string',
'Boolean',
'boolean',
'Undefined',
'undefined'
],

'indent': [
'warn',
4
],
'no-empty': 'error',
'no-empty-function': 'off',
'no-redeclare': 'error',
'no-shadow': 'off',
'no-unused-expressions': 'warn',
'no-use-before-define': 'off',
'semi': 'error',

// Jest rules
"jest/no-disabled-tests": "off",
"jest/no-focused-tests": "error",
"jest/no-identical-title": "warn",
"jest/prefer-spy-on": "warn",
"jest/prefer-to-be": "warn",
"jest/prefer-to-have-length": "warn",
"jest/valid-expect": "error"
}
}
};
8 changes: 5 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@
"typings": "dist/npm/main.d.ts",
"scripts": {
"build-package": "gulp build-rollup-package build-cdn",
"test": "jest -- test/",
"locale-tests": "jest -- locale-tests/",
"lint": "eslint ./src",
"test": "jest -- ./test",
"locale-tests": "jest -- ./locale-tests",
"lint": "eslint --quiet -- ./src ./test ./locale-tests/*.js",
"semantic-release": "semantic-release pre && semantic-prerelease publish && semantic-release post"
},
"keywords": [
Expand All @@ -34,6 +34,8 @@
"cz-conventional-changelog": "^1.1.5",
"es-jest": "^1.5.0",
"eslint": "^8.16.0",
"eslint-plugin-import": "^2.26.0",
"eslint-plugin-jest": "^26.5.3",
"ghooks": "^1.0.3",
"gulp": "^4.0.0",
"jest-cli": "^26.6.3",
Expand Down
21 changes: 17 additions & 4 deletions test/cldr.test.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,18 @@
import { load, cldr, localeInfo, dateFieldName, dateFormatNames, firstDay, weekendRange,
localeCurrency, currencyDisplay, currencyFractionOptions, currencyDisplays, numberSymbols, setData } from '../src/cldr';
import {
cldr,
currencyDisplay,
currencyDisplays,
currencyFractionOptions,
dateFieldName,
dateFormatNames,
firstDay,
load,
localeCurrency,
localeInfo,
numberSymbols,
setData,
weekendRange
} from '../src/cldr';
import { errors } from '../src/errors';

const likelySubtags = require("cldr-core/supplemental/likelySubtags.json");
Expand Down Expand Up @@ -124,10 +137,10 @@ describe('load numbers', () => {
},
"currencyFormats-numberSystem-latn":{
standard: "¤ #,##0.00 bar",
accounting: "foo #,##0.00 ¤",
accounting: "foo #,##0.00 ¤"
},
"percentFormats-numberSystem-latn": {
standard: "% #,##0.00 bar",
standard: "% #,##0.00 bar"
}
}
}
Expand Down

0 comments on commit fd04537

Please sign in to comment.