Skip to content

Commit

Permalink
Permit for...of statements (#65)
Browse files Browse the repository at this point in the history
  • Loading branch information
billyjanitsch authored Mar 23, 2023
1 parent ae954f0 commit bf11372
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 0 deletions.
12 changes: 12 additions & 0 deletions __snapshots__/test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,18 @@ exports[`lints all fixtures: prop-types.tsx 1`] = `
]
`;

exports[`lints all fixtures: syntax.tsx 1`] = `
[
{
"column": 1,
"line": 1,
"message": "Prefer default export on a file with single export.",
"rule": "import/prefer-default-export",
"severity": 2,
},
]
`;

exports[`lints all fixtures: ts-exports.ts 1`] = `[]`;

exports[`lints all fixtures: variables.js 1`] = `
Expand Down
5 changes: 5 additions & 0 deletions fixtures/syntax.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
export function forEach<T>(array: T[], callback: (item: T) => void): void {
for (const item of array) {
callback(item)
}
}
3 changes: 3 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ module.exports = {
// https://github.com/prettier/eslint-config-prettier#arrow-body-style-and-prefer-arrow-callback
'arrow-body-style': [2, 'as-needed', {requireReturnForObjectLiteral: false}],

// disallow uncommon syntax that is hard to use correctly
'no-restricted-syntax': [2, 'ForInStatement', 'LabeledStatement', 'WithStatement'],

// ensure that default, named, and namespaced imports have been exported by the target file
'import/default': 2,
'import/named': 2,
Expand Down

0 comments on commit bf11372

Please sign in to comment.