Skip to content

Commit

Permalink
Merge pull request #464 from peterramsing/what-if-i-typescript
Browse files Browse the repository at this point in the history
Migrate core to TypeScript
  • Loading branch information
peterramsing authored Aug 21, 2023
2 parents fba7988 + 4a07a08 commit 6c45335
Show file tree
Hide file tree
Showing 42 changed files with 1,795 additions and 1,326 deletions.
6 changes: 3 additions & 3 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
docs/*
dist/*
test/*
.nyc_output
coverage

// FIXME: kill these
test/check.js
test/lost-nesting.js
//FIXME: fix tests
5 changes: 4 additions & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,14 @@ module.exports = {
node: true,
},
plugins: ['prettier'],
extends: 'eslint:recommended',
extends: 'plugin:@typescript-eslint/recommended',
parser: '@typescript-eslint/parser',
parserOptions: {
ecmaVersion: 2022,
sourceType: 'module',
},
rules: {
'@typescript-eslint/no-explicit-any': 'off', //FIXME: remove this
'eol-last': 2,
'no-multiple-empty-lines': [2, { max: 2, maxEOF: 1 }],
'linebreak-style': ['error', 'unix'],
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/node.js.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ jobs:
node-version: ${{ matrix.node-version }}
cache: 'npm'
- run: npm ci
- run: npm run build
- run: npm test
- run: npm run lint
- run: npm run report-coverage
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# Created by https://www.gitignore.io

dist

### Node ###
# Logs
logs
Expand Down
5 changes: 4 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
{
"cSpell.words": ["codecov", "flexbox", "lcov", "linebreak"]
"cSpell.words": ["codecov", "flexbox", "lcov", "linebreak"],
"editor.codeActionsOnSave": {
"source.fixAll.eslint": true
}
}
40 changes: 1 addition & 39 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,42 +22,4 @@ Thanks, and don't hesitate to reach out if you have any questions!

## Git Hooks for LostGrid

LostGrid requires linting in order for PR's to be accepted.

Having a pre-commit hook is a great way to enforce this before CI catches it.

This was taken from Angular's Material project nearly wholesale. Thanks to them for the great docs!
Read how: [Material2's Wiki](https://github.com/angular/material2/wiki/Pre-commit-hook-for-linters)

`pre-commit` code for LostGrid's linter

```bash
#!/bin/sh

pass=true
RED='\033[1;31m'
GREEN='\033[0;32m'
NC='\033[0m'

echo "Running Linter:"

# Run elsint and get the output and return code
eslint=$(npm run lint)
ret_code=$?

# If it didn't pass, announce it failed and print the output
if [ $ret_code != 0 ]; then
printf "\n${RED}eslint failed:${NC}"
echo "$eslint\n"
pass=false
else
printf "${GREEN}eslint passed.${NC}\n"
fi

# If there were no failures, it is good to commit
if $pass; then
exit 0
fi

exit 1
```
Husky should take care of this for you now
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,13 @@ LostGrid makes use of [`calc()`](https://developer.mozilla.org/en-US/docs/Web/CS

Read the docs on [LostGrid.org](http://lostgrid.org/docs.html)!

## Roadmap

- [ ] Migrate the core of the code to TypeScript
- [ ] Remove a lot of the complexity, focusing on moving complexity to CSS Grid
- [ ] Optimize LostGrid to support CSS Grid, getting out of the way while helping enabled developers to use CSS Grid
- [ ] Maintain backwards compatibility with older browsers for those who need it

## Browser Support

- LostGrid relies on [`calc()`](https://developer.mozilla.org/en-US/docs/Web/CSS/calc) to create the grid. Thus, LostGrid is limited to browsers that support `calc()`. The great thing is that `calc()` is widely supported in all current browsers and the LostGrid usage of `calc()` is supported as far back as IE9+.
Expand Down
41 changes: 0 additions & 41 deletions lib/core/lg-logic.js

This file was deleted.

33 changes: 0 additions & 33 deletions lib/core/lg-new-block.js

This file was deleted.

111 changes: 0 additions & 111 deletions lib/core/lg-utilities.js

This file was deleted.

3 changes: 0 additions & 3 deletions lib/lost-vars-gutter.js

This file was deleted.

50 changes: 0 additions & 50 deletions lib/lost-vars.js

This file was deleted.

Loading

0 comments on commit 6c45335

Please sign in to comment.