Skip to content

Commit

Permalink
rename all js files to ts
Browse files Browse the repository at this point in the history
  • Loading branch information
kensnyder committed Sep 8, 2024
1 parent 4ef8e9d commit 70d188b
Show file tree
Hide file tree
Showing 81 changed files with 3,703 additions and 16,916 deletions.
245 changes: 2 additions & 243 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,250 +3,9 @@ const OFF = 0,
ERROR = 2;

module.exports = {
parserOptions: {
ecmaVersion: 2018,
sourceType: 'module',
},

extends: ['prettier'],
env: {
es6: true,
node: true,
},

ecmaFeatures: {
// env=es6 doesn't include modules, which we are using
modules: true,
},

extends: 'eslint:recommended',

globals: {
navigator: true,
describe: true,
jest: true,
it: true,
beforeAll: true,
beforeEach: true,
expect: true,
},

rules: {
// Possible Errors (overrides from recommended set)
'no-extra-parens': OFF,
'no-unexpected-multiline': ERROR,
// All JSDoc comments must be valid
'valid-jsdoc': [
WARN,
{
requireReturn: false,
requireReturnDescription: false,
requireParamDescription: true,
prefer: {
return: 'return',
},
},
],

// Best Practices

// Allowed a getter without setter, but all setters require getters
'accessor-pairs': [
ERROR,
{
getWithoutSet: false,
setWithoutGet: true,
},
],
'block-scoped-var': WARN,
'consistent-return': OFF,
curly: ERROR,
'default-case': OFF,
// the dot goes with the property when doing multiline
'dot-location': [WARN, 'property'],
'dot-notation': WARN,
eqeqeq: [ERROR, 'smart'],
'guard-for-in': WARN,
'no-alert': ERROR,
'no-caller': ERROR,
'no-case-declarations': WARN,
'no-div-regex': WARN,
'no-else-return': WARN,
// 'no-empty-label': WARN,
'no-empty-pattern': WARN,
'no-eq-null': WARN,
'no-eval': ERROR,
'no-extend-native': ERROR,
'no-extra-bind': WARN,
'no-floating-decimal': WARN,
'no-implicit-coercion': [
WARN,
{
boolean: true,
number: true,
string: true,
},
],
'no-implied-eval': ERROR,
'no-invalid-this': ERROR,
'no-iterator': ERROR,
'no-labels': WARN,
'no-lone-blocks': WARN,
'no-loop-func': ERROR,
'no-magic-numbers': OFF,
'no-multi-spaces': ERROR,
'no-multi-str': WARN,
'no-native-reassign': ERROR,
'no-new-func': ERROR,
'no-new-wrappers': ERROR,
'no-new': ERROR,
'no-octal-escape': ERROR,
'no-param-reassign': OFF,
'no-process-env': WARN,
'no-proto': ERROR,
'no-prototype-builtins': OFF,
'no-redeclare': ERROR,
'no-return-assign': OFF,
'no-script-url': ERROR,
'no-self-compare': ERROR,
'no-throw-literal': ERROR,
'no-unused-expressions': ERROR,
'no-useless-call': ERROR,
'no-useless-concat': ERROR,
'no-void': WARN,
// Produce warnings when something is commented as TODO or FIXME
'no-warning-comments': [
WARN,
{
terms: ['TODO', 'FIXME'],
location: 'start',
},
],
'no-with': WARN,
radix: WARN,
'vars-on-top': OFF,
// Enforces the style of wrapped functions
'wrap-iife': [ERROR, 'outside'],
yoda: ERROR,

// Strict Mode - for ES6, never use strict.
strict: [ERROR, 'never'],

// Variables
'init-declarations': OFF,
'no-catch-shadow': WARN,
'no-delete-var': ERROR,
'no-label-var': ERROR,
'no-shadow-restricted-names': ERROR,
'no-shadow': WARN,
// We require all vars to be initialized (see init-declarations)
// If we NEED a var to be initialized to undefined, it needs to be explicit
'no-undef-init': OFF,
'no-undef': ERROR,
'no-undefined': OFF,
'no-unused-vars': OFF,
// Disallow hoisting - let & const don't allow hoisting anyhow
'no-use-before-define': OFF,

// Node.js and CommonJS
'callback-return': OFF,
'global-require': ERROR,
'handle-callback-err': WARN,
'no-mixed-requires': WARN,
'no-new-require': ERROR,
// Use path.concat instead
'no-path-concat': ERROR,
'no-process-exit': OFF,
'no-restricted-modules': OFF,
'no-sync': OFF,

// ECMAScript 6 support
'arrow-body-style': OFF,
'arrow-parens': OFF,
'arrow-spacing': [ERROR, { before: true, after: true }],
'constructor-super': ERROR,
'generator-star-spacing': [ERROR, 'before'],
// 'no-arrow-condition': ERROR,
'no-class-assign': ERROR,
'no-const-assign': ERROR,
'no-dupe-class-members': ERROR,
'no-this-before-super': ERROR,
'no-var': WARN,
'object-shorthand': [WARN, 'never'],
'prefer-arrow-callback': WARN,
'prefer-spread': WARN,
'prefer-template': WARN,
'require-yield': ERROR,
'no-console': OFF,

// Stylistic - everything here is a warning because of style.
'array-bracket-spacing': OFF, // prettier will handle this
'block-spacing': [WARN, 'always'],
'brace-style': [WARN, '1tbs', { allowSingleLine: false }],
camelcase: WARN,
'comma-spacing': [WARN, { before: false, after: true }],
'comma-style': [WARN, 'last'],
'computed-property-spacing': [WARN, 'never'],
'consistent-this': [WARN, 'self'],
'eol-last': WARN,
'func-names': WARN,
'func-style': [WARN, 'declaration'],
'id-length': [WARN, { min: 2, max: 32 }],
indent: OFF, // prettier will handle this
'jsx-quotes': [WARN, 'prefer-double'],
'linebreak-style': [WARN, 'unix'],
'lines-around-comment': [WARN, { beforeBlockComment: false }],
'max-depth': [WARN, 8],
'max-len': OFF,
'max-nested-callbacks': [WARN, 8],
'max-params': [WARN, 8],
'new-cap': WARN,
'new-parens': WARN,
'no-array-constructor': WARN,
'no-bitwise': OFF,
'no-continue': OFF,
'no-fallthrough': OFF,
'no-inline-comments': OFF,
'no-lonely-if': WARN,
'no-mixed-spaces-and-tabs': WARN,
'no-multiple-empty-lines': WARN,
'no-negated-condition': OFF,
'no-nested-ternary': WARN,
'no-new-object': WARN,
'no-plusplus': OFF,
'no-spaced-func': WARN,
'no-ternary': OFF,
'no-trailing-spaces': WARN,
'no-underscore-dangle': WARN,
'no-unneeded-ternary': WARN,
'object-curly-spacing': [WARN, 'always'],
'one-var': OFF,
'operator-assignment': [WARN, 'never'],
'operator-linebreak': OFF,
'padded-blocks': [WARN, 'never'],
'quote-props': OFF,
quotes: OFF,
'require-jsdoc': [
WARN,
{
require: {
FunctionDeclaration: true,
MethodDefinition: true,
ClassDeclaration: false,
},
},
],
'semi-spacing': [WARN, { before: false, after: true }],
semi: [ERROR, 'always'],
'sort-vars': OFF,
// 'space-after-keywords': [WARN, 'always'],
'space-before-blocks': [WARN, 'always'],
'space-before-function-paren': [WARN, 'never'],
// 'space-before-keywords': [WARN, 'always'],
'space-in-parens': [WARN, 'never'],
'space-infix-ops': [WARN, { int32Hint: true }],
// 'space-return-throw-case': ERROR,
'space-unary-ops': ERROR,
'spaced-comment': [WARN, 'always'],
'wrap-regex': OFF,
es6: true
},
};
32 changes: 32 additions & 0 deletions .github/workflows/workflow.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: build
on: [push]
jobs:
run:
runs-on: ubuntu-latest

strategy:
matrix:
node-version: [18.x, 20.x, latest]

steps:
- name: ➡️ Checkout repository
uses: actions/checkout@v4

- name: 🟢 Set up Node ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}

- name: ⬇️ Install dependencies
run: npm install

- name: 🏃 Run tests
run: npm run coverage

- name: ☂️ Upload to codecov
if: matrix.node-version == 'latest'
uses: codecov/codecov-action@v4
with:
fail_ci_if_error: true
token: ${{ secrets.CODECOV_TOKEN }}
verbose: true
4 changes: 4 additions & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
fund=false
audit=false
save-exact=true
legacy-peer-deps=true
13 changes: 0 additions & 13 deletions .prettierrc.js

This file was deleted.

14 changes: 14 additions & 0 deletions .prettierrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"plugins": ["prettier-plugin-organize-imports"],
"trailingComma": "es5",
"printWidth": 80,
"tabWidth": 2,
"useTabs": false,
"semi": true,
"singleQuote": true,
"bracketSpacing": true,
"jsxBracketSameLine": false,
"arrowParens": "avoid",
"endOfLine": "lf",
"fluid": false
}
15 changes: 9 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
# any-date-parser

[![NPM Link](https://img.shields.io/npm/v/any-date-parser?v=1.6.0)](https://npm.com/package/any-date-parser)
[![Minified Size](https://badgen.net/bundlephobia/min/react)](https://bundlephobia.com/package/[email protected])
[![Build Status](https://travis-ci.org/kensnyder/any-date-parser.svg?branch=master&v=1.6.0)](https://travis-ci.org/kensnyder/any-date-parser)
[![Code Coverage](https://codecov.io/gh/kensnyder/any-date-parser/branch/master/graph/badge.svg?v=1.6.0)](https://codecov.io/gh/kensnyder/any-date-parser)
[![ISC License](https://img.shields.io/npm/l/any-date-parser.svg?v=1.6.0)](https://opensource.org/licenses/ISC)
[![NPM Link](https://badgen.net/npm/v/any-date-parser?v=1.6.0)](https://npmjs.com/package/any-date-parser)
[![Language](https://badgen.net/static/language/TS?v=1.6.0)](https://github.com/search?q=repo:kensnyder/any-date-parser++language:TypeScript&type=code)
[![Build Status](https://github.com/kensnyder/any-date-parser/actions/workflows/workflow.yml/badge.svg?v=1.6.0)](https://github.com/kensnyder/any-date-parser/actions)
[![Code Coverage](https://codecov.io/gh/kensnyder/any-date-parser/branch/main/graph/badge.svg?v=1.6.0)](https://codecov.io/gh/kensnyder/any-date-parser)
[![Gzipped Size](https://badgen.net/bundlephobia/minzip/any-date-parser?label=minzipped&v=1.6.0)](https://bundlephobia.com/package/[email protected])
[![Dependency details](https://badgen.net/bundlephobia/dependency-count/any-date-parser?v=1.6.0)](https://www.npmjs.com/package/any-date-parser?activeTab=dependencies)
[![Tree shakeable](https://badgen.net/bundlephobia/tree-shaking/any-date-parser?v=1.6.0)](https://www.npmjs.com/package/any-date-parser)
[![ISC License](https://badgen.net/github/license/kensnyder/any-date-parser?v=1.6.0)](https://opensource.org/licenses/ISC)

Parse a wide range of date formats including human-input dates.

Supports Node, IE11+ and evergreen browsers.
Supports Node and browsers. Uses `Intl` to provide parsing support for all installed locales.

## Installation

Expand Down
Loading

0 comments on commit 70d188b

Please sign in to comment.