Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor!: use eslint 9 #29

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 5 additions & 2 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
# editorconfig.org

[*]
charset = utf-8
indent_style = space
indent_size = 2
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
trim_trailing_whitespace = true

[*.md]
trim_trailing_whitespace = false
4 changes: 0 additions & 4 deletions .eslintrc.js

This file was deleted.

2 changes: 2 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
* text=auto
package-lock.json -diff
51 changes: 17 additions & 34 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,37 +1,20 @@
# Logs
logs
*.log
npm-debug.log*

# Runtime data
pids
*.pid
*.seed

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage

# nyc test coverage
.nyc_output

# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# node-waf configuration
.lock-wscript

# Compiled binary addons (http://nodejs.org/api/addons.html)
build/Release

# Dependency directories
node_modules
jspm_packages

# Optional npm cache directory
.npm

# Optional REPL history
.node_repl_history
.cspellcache
.eslintcache

/coverage
/dist
/local
/reports
/node_modules
/test/outputs

.DS_Store
Thumbs.db
.idea
.vscode
*.sublime-project
*.sublime-workspace
*.iml
1 change: 1 addition & 0 deletions .husky/commit-msg
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
npx --no-install commitlint --edit $1
1 change: 1 addition & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
npx --no-install lint-staged
4 changes: 4 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
/coverage
/dist
/node_modules
CHANGELOG.md
1 change: 1 addition & 0 deletions .prettierrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
module.exports = { singleQuote: true };
3 changes: 1 addition & 2 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

Copyright JS Foundation and other contributors

Permission is hereby granted, free of charge, to any person obtaining
Expand All @@ -18,4 +17,4 @@ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
4 changes: 0 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,15 +55,11 @@ _In your .eslintrc.js || .yml || .json add ..._
<tbody>
</table>


[npm]: https://img.shields.io/npm/v/@webpack-contrib/eslint-config-webpack.svg
[npm-url]: https://npmjs.com/package/@webpack-contrib/eslint-config-webpack

[chat]: https://img.shields.io/badge/gitter-webpack%2Fwebpack-brightgreen.svg
[chat-url]: https://gitter.im/webpack/webpack

[test]: http://img.shields.io/travis/webpack-contrib/eslint-config-webpack.svg
[test-url]: https://travis-ci.org/webpack-contrib/eslint-config-webpack

[cover]: https://coveralls.io/repos/github/webpack-contrib/eslint-config-webpack/badge.svg?branch=master
[cover-url]: https://coveralls.io/github/webpack-contrib/eslint-config-webpack?branch=master
8 changes: 8 additions & 0 deletions commitlint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
module.exports = {
extends: ['@commitlint/config-conventional'],
rules: {
'header-max-length': [0],
'body-max-line-length': [0],
'footer-max-line-length': [0],
},
};
1 change: 1 addition & 0 deletions eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
module.exports = [require('./'), require('eslint-config-prettier')];
38 changes: 20 additions & 18 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,22 +1,24 @@
const globals = require('globals');

module.exports = {
extends: [
'./rules/imports',
'./rules/possible-errors',
'./rules/best-practices',
'./rules/variables',
'./rules/node',
'./rules/stylistic-issues',
'./rules/es2015'
].map(require.resolve),
parserOptions: {
ecmaVersion: 2018,
env: {
es6: true,
jest: true
// require('./rules/imports'),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why it is comment?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

...require('./rules/possible-errors'),
...require('./rules/best-practices'),
...require('./rules/variables'),
...require('./rules/node'),
...require('./rules/stylistic-issues'),
...require('./rules/es2015'),
...{
languageOptions: {
ecmaVersion: 2018,
sourceType: 'module',
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This can be a problem, some packages are still in commonjs

Let's make two things - "@webpack-contrib/eslint-config-webpack/commonjs" and "@webpack-contrib/eslint-config-webpack/module" and the second requires extension for import ... from ...

globals: {
...globals.es6,
...globals.jest,
},
},
rules: {
strict: 'error',
},
sourceType: 'module'
},
rules: {
strict: 'error',
},
};
4 changes: 4 additions & 0 deletions lint-staged.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
module.exports = {
'*': ['prettier --cache --write --ignore-unknown'],
'*.js': ['eslint --cache --fix'],
};